|
10 | 10 | "node": true,
|
11 | 11 | "es6": true
|
12 | 12 | },
|
| 13 | + "extends": [ |
| 14 | + "eslint:recommended", |
| 15 | + "plugin:@typescript-eslint/recommended", |
| 16 | + "plugin:@typescript-eslint/stylistic" |
| 17 | + ], |
13 | 18 | "plugins": [
|
14 |
| - "@typescript-eslint", "no-null", "import", "eslint-plugin-local" |
| 19 | + "@typescript-eslint", |
| 20 | + "no-null", |
| 21 | + "eslint-plugin-local" |
15 | 22 | ],
|
16 | 23 | "ignorePatterns": [
|
17 | 24 | "**/node_modules/**",
|
|
25 | 32 | "/coverage/**"
|
26 | 33 | ],
|
27 | 34 | "rules": {
|
28 |
| - "sort-imports": ["error", { |
29 |
| - "ignoreCase": true, |
30 |
| - "ignoreDeclarationSort": true, |
31 |
| - "allowSeparatedGroups": true |
32 |
| - }], |
33 |
| - |
34 |
| - "@typescript-eslint/adjacent-overload-signatures": "error", |
35 |
| - "@typescript-eslint/array-type": "error", |
36 |
| - "@typescript-eslint/no-array-constructor": "error", |
| 35 | + // eslint |
| 36 | + "dot-notation": "error", |
| 37 | + "eqeqeq": "error", |
| 38 | + "no-caller": "error", |
| 39 | + "no-constant-condition": ["error", { "checkLoops": false }], |
| 40 | + "no-eval": "error", |
| 41 | + "no-extra-bind": "error", |
| 42 | + "no-new-func": "error", |
| 43 | + "no-new-wrappers": "error", |
| 44 | + "no-return-await": "error", |
| 45 | + "no-restricted-globals": [ |
| 46 | + "error", |
| 47 | + { "name": "setTimeout" }, |
| 48 | + { "name": "clearTimeout" }, |
| 49 | + { "name": "setInterval" }, |
| 50 | + { "name": "clearInterval" }, |
| 51 | + { "name": "setImmediate" }, |
| 52 | + { "name": "clearImmediate" } |
| 53 | + ], |
| 54 | + "no-template-curly-in-string": "error", |
| 55 | + "no-throw-literal": "error", |
| 56 | + "no-undef-init": "error", |
| 57 | + "no-var": "error", |
| 58 | + "object-shorthand": "error", |
| 59 | + "prefer-const": "error", |
| 60 | + "prefer-object-spread": "error", |
| 61 | + "unicode-bom": ["error", "never"], |
37 | 62 |
|
38 |
| - "brace-style": "off", |
39 |
| - "@typescript-eslint/brace-style": ["error", "stroustrup", { "allowSingleLine": true }], |
| 63 | + // Enabled in eslint:recommended, but not applicable here |
| 64 | + "no-extra-boolean-cast": "off", |
| 65 | + "no-case-declarations": "off", |
| 66 | + "no-cond-assign": "off", |
| 67 | + "no-control-regex": "off", |
| 68 | + "no-inner-declarations": "off", |
40 | 69 |
|
| 70 | + // @typescript-eslint/eslint-plugin |
41 | 71 | "@typescript-eslint/naming-convention": [
|
42 | 72 | "error",
|
43 | 73 | { "selector": "typeLike", "format": ["PascalCase"], "filter": { "regex": "^(__String|[A-Za-z]+_[A-Za-z]+)$", "match": false } },
|
|
51 | 81 | { "selector": "property", "format": null }
|
52 | 82 | ],
|
53 | 83 |
|
54 |
| - "@typescript-eslint/consistent-type-definitions": ["error", "interface"], |
55 |
| - "@typescript-eslint/consistent-type-assertions": ["error", { "assertionStyle": "as" }], |
56 |
| - |
57 |
| - "max-statements-per-line": ["error", { "max": 1 }], |
58 |
| - |
59 |
| - "no-duplicate-imports": "off", |
60 |
| - "@typescript-eslint/no-duplicate-imports": "error", |
61 |
| - |
62 |
| - "@typescript-eslint/no-inferrable-types": "error", |
63 |
| - "@typescript-eslint/no-misused-new": "error", |
64 |
| - "@typescript-eslint/no-this-alias": "error", |
65 |
| - |
| 84 | + "@typescript-eslint/unified-signatures": "error", |
66 | 85 | "no-unused-expressions": "off",
|
67 | 86 | "@typescript-eslint/no-unused-expressions": ["error", { "allowTernary": true }],
|
68 | 87 |
|
69 |
| - "@typescript-eslint/prefer-for-of": "error", |
70 |
| - "@typescript-eslint/prefer-function-type": "error", |
71 |
| - "@typescript-eslint/prefer-namespace-keyword": "error", |
72 |
| - "@typescript-eslint/prefer-as-const": "error", |
73 |
| - |
74 |
| - "quotes": "off", |
75 |
| - "@typescript-eslint/quotes": ["error", "double", { "avoidEscape": true, "allowTemplateLiterals": true }], |
76 |
| - |
77 |
| - "semi": "off", |
78 |
| - "@typescript-eslint/semi": "error", |
79 |
| - "@typescript-eslint/no-extra-semi": "error", |
80 |
| - |
81 |
| - "space-before-function-paren": "off", |
82 |
| - "@typescript-eslint/space-before-function-paren": ["error", { |
83 |
| - "asyncArrow": "always", |
84 |
| - "anonymous": "always", |
85 |
| - "named": "never" |
86 |
| - }], |
87 |
| - |
88 |
| - "@typescript-eslint/triple-slash-reference": "error", |
89 |
| - "@typescript-eslint/type-annotation-spacing": "error", |
90 |
| - "@typescript-eslint/unified-signatures": "error", |
| 88 | + // Rules enabled in typescript-eslint configs that are not applicable here |
| 89 | + "@typescript-eslint/ban-ts-comment": "off", |
| 90 | + "@typescript-eslint/class-literal-property-style": "off", |
| 91 | + "@typescript-eslint/consistent-indexed-object-style": "off", |
| 92 | + "@typescript-eslint/no-duplicate-enum-values": "off", |
| 93 | + "@typescript-eslint/no-empty-function": "off", |
| 94 | + "@typescript-eslint/no-namespace": "off", |
| 95 | + "@typescript-eslint/no-non-null-asserted-optional-chain": "off", |
| 96 | + "@typescript-eslint/no-var-requires": "off", |
| 97 | + "@typescript-eslint/no-empty-interface": "off", |
| 98 | + "@typescript-eslint/no-explicit-any": "off", |
| 99 | + "@typescript-eslint/ban-types": [ |
| 100 | + "error", |
| 101 | + { |
| 102 | + "extendDefaults": true, |
| 103 | + "types": { |
| 104 | + // This is theoretically good, but ts-eslint appears to mistake our declaration of Symbol for the global Symbol type. |
| 105 | + // See: https://github.com/typescript-eslint/typescript-eslint/issues/7306 |
| 106 | + "Symbol": false, |
| 107 | + "{}": false // {} is a totally useful and valid type. |
| 108 | + } |
| 109 | + } |
| 110 | + ], |
| 111 | + "@typescript-eslint/no-unused-vars": [ |
| 112 | + "warn", |
| 113 | + { |
| 114 | + // Ignore: (solely underscores | starting with exactly one underscore) |
| 115 | + "argsIgnorePattern": "^(_+$|_[^_])", |
| 116 | + "varsIgnorePattern": "^(_+$|_[^_])" |
| 117 | + } |
| 118 | + ], |
91 | 119 |
|
92 |
| - "@typescript-eslint/no-extra-non-null-assertion": "error", |
| 120 | + // Pending https://github.com/typescript-eslint/typescript-eslint/issues/4820 |
| 121 | + "@typescript-eslint/prefer-optional-chain": "off", |
93 | 122 |
|
94 | 123 | // scripts/eslint/rules
|
95 |
| - "local/object-literal-surrounding-space": "error", |
96 |
| - "local/no-type-assertion-whitespace": "error", |
97 |
| - "local/type-operator-spacing": "error", |
98 |
| - "local/only-arrow-functions": ["error", { |
99 |
| - "allowNamedFunctions": true , |
100 |
| - "allowDeclarations": true |
101 |
| - }], |
102 |
| - "local/no-double-space": "error", |
103 |
| - "local/boolean-trivia": "error", |
| 124 | + "local/only-arrow-functions": [ |
| 125 | + "error", |
| 126 | + { |
| 127 | + "allowNamedFunctions": true, |
| 128 | + "allowDeclarations": true |
| 129 | + } |
| 130 | + ], |
| 131 | + "local/argument-trivia": "error", |
104 | 132 | "local/no-in-operator": "error",
|
105 |
| - "local/simple-indent": "error", |
106 | 133 | "local/debug-assert": "error",
|
107 | 134 | "local/no-keywords": "error",
|
108 | 135 | "local/jsdoc-format": "error",
|
109 | 136 |
|
110 |
| - // eslint-plugin-import |
111 |
| - "import/no-extraneous-dependencies": ["error", { "optionalDependencies": false }], |
112 |
| - |
113 | 137 | // eslint-plugin-no-null
|
114 |
| - "no-null/no-null": "error", |
115 |
| - |
116 |
| - // eslint |
117 |
| - "constructor-super": "error", |
118 |
| - "curly": ["error", "multi-line"], |
119 |
| - "dot-notation": "error", |
120 |
| - "eqeqeq": "error", |
121 |
| - "linebreak-style": ["error", "windows"], |
122 |
| - "new-parens": "error", |
123 |
| - "no-caller": "error", |
124 |
| - "no-duplicate-case": "error", |
125 |
| - "no-empty": "error", |
126 |
| - "no-eval": "error", |
127 |
| - "no-extra-bind": "error", |
128 |
| - "no-fallthrough": "error", |
129 |
| - "no-new-func": "error", |
130 |
| - "no-new-wrappers": "error", |
131 |
| - "no-return-await": "error", |
132 |
| - "no-restricted-globals": ["error", |
133 |
| - { "name": "setTimeout" }, |
134 |
| - { "name": "clearTimeout" }, |
135 |
| - { "name": "setInterval" }, |
136 |
| - { "name": "clearInterval" }, |
137 |
| - { "name": "setImmediate" }, |
138 |
| - { "name": "clearImmediate" } |
139 |
| - ], |
140 |
| - "no-sparse-arrays": "error", |
141 |
| - "no-template-curly-in-string": "error", |
142 |
| - "no-throw-literal": "error", |
143 |
| - "no-trailing-spaces": "error", |
144 |
| - "no-undef-init": "error", |
145 |
| - "no-unsafe-finally": "error", |
146 |
| - "no-unused-labels": "error", |
147 |
| - "no-var": "error", |
148 |
| - "object-shorthand": "error", |
149 |
| - "prefer-const": "error", |
150 |
| - "prefer-object-spread": "error", |
151 |
| - "quote-props": ["error", "consistent-as-needed"], |
152 |
| - "space-in-parens": "error", |
153 |
| - "unicode-bom": ["error", "never"], |
154 |
| - "use-isnan": "error", |
155 |
| - "no-prototype-builtins": "error", |
156 |
| - "no-self-assign": "error", |
157 |
| - "no-dupe-else-if": "error" |
| 138 | + "no-null/no-null": "error" |
158 | 139 | },
|
159 | 140 | "overrides": [
|
160 | 141 | // By default, the ESLint CLI only looks at .js files. But, it will also look at
|
161 | 142 | // any files which are referenced in an override config. Most users of typescript-eslint
|
162 |
| - // get this behavior by default by extending a recommended typescript-eslint config, which |
| 143 | + // get this behavior by default by extending a recommended typescript-eslint config, which |
163 | 144 | // just so happens to override some core ESLint rules. We don't extend from any config, so
|
164 | 145 | // explicitly reference TS files here so the CLI picks them up.
|
165 | 146 | //
|
|
172 | 153 | "files": ["*.mjs", "*.mts"],
|
173 | 154 | "rules": {
|
174 | 155 | // These globals don't exist outside of CJS files.
|
175 |
| - "no-restricted-globals": ["error", |
| 156 | + "no-restricted-globals": [ |
| 157 | + "error", |
176 | 158 | { "name": "__filename" },
|
177 | 159 | { "name": "__dirname" },
|
178 | 160 | { "name": "require" },
|
|
0 commit comments