or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

tessl/npm-rushstack--eslint-patch

Enhance ESLint with better support for large scale monorepos

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@rushstack/eslint-patch@1.12.x

To install, run

npx @tessl/cli install tessl/npm-rushstack--eslint-patch@1.12.0

0

# @rushstack/eslint-patch

1

2

@rushstack/eslint-patch enhances ESLint with better support for large scale monorepos through runtime patches that enable enhanced functionality. It operates as "monkey patches" that modify the ESLint engine in memory, maintaining full compatibility with existing ESLint versions and editor extensions.

3

4

## Package Information

5

6

- **Package Name**: @rushstack/eslint-patch

7

- **Package Type**: npm

8

- **Language**: TypeScript

9

- **Installation**: `npm install --save-dev @rushstack/eslint-patch`

10

11

## Core Imports

12

13

The package does not have a default entry point and must be imported using specific feature paths. Attempting to import the main entry point will throw an error with usage instructions:

14

15

```javascript

16

// For modern module resolution patch

17

require("@rushstack/eslint-patch/modern-module-resolution");

18

19

// For custom config package names patch

20

require("@rushstack/eslint-patch/custom-config-package-names");

21

22

// For bulk suppressions patch

23

require("@rushstack/eslint-patch/eslint-bulk-suppressions");

24

```

25

26

## Basic Usage

27

28

Add patches to the top of your `.eslintrc.js` file:

29

30

```javascript

31

// Load patches (order matters for some combinations)

32

require("@rushstack/eslint-patch/modern-module-resolution");

33

require("@rushstack/eslint-patch/custom-config-package-names");

34

require("@rushstack/eslint-patch/eslint-bulk-suppressions");

35

36

module.exports = {

37

extends: ['@your-company/eslint-config'],

38

parserOptions: { tsconfigRootDir: __dirname }

39

};

40

```

41

42

The patches automatically detect and support ESLint versions 6.x, 7.x, 8.x, and 9.x.

43

44

## Architecture

45

46

@rushstack/eslint-patch is built around several key components:

47

48

- **Runtime Patching System**: Core infrastructure that detects ESLint version and applies appropriate patches

49

- **Module Resolution Override**: Patches ESLint's plugin and config loading to support monorepo scenarios

50

- **Suppression Management**: File-based bulk suppression system for managing legacy lint violations

51

- **Version Compatibility**: Automatic detection and handling of different ESLint major versions

52

53

## Capabilities

54

55

### Modern Module Resolution

56

57

Allows ESLint config packages to provide their own plugin dependencies, eliminating the need to copy+paste devDependencies across projects in a monorepo.

58

59

```javascript { .api }

60

// Entry point that applies the patch

61

require("@rushstack/eslint-patch/modern-module-resolution");

62

```

63

64

[Modern Module Resolution](./modern-module-resolution.md)

65

66

### Custom Config Package Names

67

68

Removes ESLint's requirement for 'eslint-config' to appear in shareable config package names, enabling rig packages to provide ESLint configurations.

69

70

```javascript { .api }

71

// Entry point that applies the patch

72

require("@rushstack/eslint-patch/custom-config-package-names");

73

```

74

75

[Custom Config Package Names](./custom-config-package-names.md)

76

77

### Bulk Suppressions

78

79

Enables machine-generated lint suppressions to be stored in a separate `.eslint-bulk-suppressions.json` file rather than cluttering source code with thousands of `// eslint-ignore-next-line` directives.

80

81

```javascript { .api }

82

// Entry point that applies the patch

83

require("@rushstack/eslint-patch/eslint-bulk-suppressions");

84

```

85

86

[Bulk Suppressions](./bulk-suppressions.md)

87

88

## Error Handling

89

90

If patches cannot be applied due to unsupported ESLint versions or missing dependencies, the package will throw descriptive errors:

91

92

- **Unsupported ESLint version**: Versions outside 6.x-9.x range

93

- **Missing ESLint installation**: Cannot locate ESLint modules to patch

94

- **Module resolution failures**: Cannot find required ESLint internal modules

95

- **Default entry point access**: The main entry point throws an error by design to prevent accidental usage without specific feature imports

96

97

## Supported ESLint Versions

98

99

- ESLint 6.x

100

- ESLint 7.x

101

- ESLint 8.x

102

- ESLint 9.x (including flat config support)