@storm-software/eslint 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/{base.cjs → base.js} +1 -27
- package/{graphql.cjs → graphql.js} +1 -25
- package/index.js +1465 -0
- package/{javascript.cjs → javascript.js} +2 -31
- package/jest.js +12 -0
- package/{json.cjs → json.js} +1 -27
- package/{mdx.cjs → mdx.js} +1 -27
- package/meta.json +1 -1
- package/{next.cjs → next.js} +1 -14
- package/package.json +6 -6
- package/packages/eslint/src/base.d.ts +1 -0
- package/packages/eslint/src/constants.d.ts +20 -0
- package/packages/eslint/src/graphql.d.ts +1 -0
- package/packages/eslint/src/index.d.ts +19 -0
- package/packages/eslint/src/javascript.d.ts +1 -0
- package/packages/eslint/src/jest.d.ts +1 -0
- package/packages/eslint/src/json.d.ts +1 -0
- package/packages/eslint/src/mdx.d.ts +1 -0
- package/packages/eslint/src/next.d.ts +1 -0
- package/packages/eslint/src/nx.d.ts +1 -0
- package/packages/eslint/src/react.d.ts +1 -0
- package/packages/eslint/src/recommended.d.ts +1 -0
- package/packages/eslint/src/rules/import.d.ts +3 -0
- package/packages/eslint/src/rules/jsx-a11y.d.ts +3 -0
- package/packages/eslint/src/rules/react.d.ts +3 -0
- package/packages/eslint/src/rules/storm.d.ts +3 -0
- package/packages/eslint/src/rules/ts-docs.d.ts +3 -0
- package/packages/eslint/src/rules/unicorn.d.ts +3 -0
- package/packages/eslint/src/typescript.d.ts +1 -0
- package/packages/eslint/src/yml.d.ts +1 -0
- package/{react.cjs → react.js} +1 -28
- package/{recommended.cjs → recommended.js} +1 -27
- package/{typescript.cjs → typescript.js} +2 -31
- package/{yml.cjs → yml.js} +1 -27
- package/index.cjs +0 -949
- package/jest.cjs +0 -36
package/index.cjs
DELETED
|
@@ -1,949 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// packages/eslint/src/index.ts
|
|
30
|
-
var src_exports = {};
|
|
31
|
-
__export(src_exports, {
|
|
32
|
-
CODE_BLOCK: () => CODE_BLOCK,
|
|
33
|
-
CODE_FILE: () => CODE_FILE,
|
|
34
|
-
JS_FILES: () => JS_FILES,
|
|
35
|
-
REACT_RESTRICTED_SYNTAX: () => REACT_RESTRICTED_SYNTAX,
|
|
36
|
-
RESTRICTED_GLOBALS: () => RESTRICTED_GLOBALS,
|
|
37
|
-
RESTRICTED_MODULES: () => RESTRICTED_MODULES,
|
|
38
|
-
RESTRICTED_SYNTAX: () => RESTRICTED_SYNTAX,
|
|
39
|
-
TS_FILE: () => TS_FILE
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(src_exports);
|
|
42
|
-
|
|
43
|
-
// packages/eslint/src/constants.ts
|
|
44
|
-
var RESTRICTED_SYNTAX = [
|
|
45
|
-
{
|
|
46
|
-
// ❌ readFile(…, { encoding: … })
|
|
47
|
-
selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
|
|
48
|
-
message: "Specify encoding as last argument instead of object with encoding key"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
// ❌ readFile(…, {})
|
|
52
|
-
selector: "CallExpression[callee.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
|
|
53
|
-
message: "Specify encoding as last argument"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
// ❌ readFileSync(…).toString(…)
|
|
57
|
-
selector: "CallExpression[callee.name=readFileSync][parent.property.name=toString]",
|
|
58
|
-
message: "toString is redundant, specify encoding as last argument"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
// ❌ ….readFile(…, { encoding: … })
|
|
62
|
-
selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=1] Property[key.name=encoding]",
|
|
63
|
-
message: "Specify encoding as last argument instead of object with encoding key"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
// ❌ ….readFile(…, {})
|
|
67
|
-
selector: "CallExpression[callee.type=MemberExpression][callee.property.name=/readFileSync|readFile|writeFileSync|writeFile/] > .arguments:last-child[type=ObjectExpression][properties.length=0]",
|
|
68
|
-
message: "Specify encoding as last argument"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
// ❌ Boolean(…)
|
|
72
|
-
selector: "CallExpression[callee.name=Boolean][arguments.1.elements.length!=0]",
|
|
73
|
-
message: "Prefer `!!\u2026` over `Boolean(\u2026)` because TypeScript infers a narrow literal boolean `type: true` instead of `type: boolean`."
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
// ❌ process.browser
|
|
77
|
-
selector: "ExpressionStatement[expression.object.name=process][expression.property.name=browser]",
|
|
78
|
-
message: "`process.browser` is deprecated, use `!!globalThis.window`"
|
|
79
|
-
}
|
|
80
|
-
// {
|
|
81
|
-
// // ❌ let { foo: { bar } } = baz
|
|
82
|
-
// // ✅ let { bar } = baz.foo
|
|
83
|
-
// // ✅ let { foo: { bar } } = await baz
|
|
84
|
-
// selector:
|
|
85
|
-
// 'VariableDeclarator[init.type!=AwaitExpression] > ObjectPattern[properties.length=1][properties.0.value.type=ObjectPattern]',
|
|
86
|
-
// message: 'Do not use nested destructuring.',
|
|
87
|
-
// },
|
|
88
|
-
];
|
|
89
|
-
var REACT_RESTRICTED_SYNTAX = [
|
|
90
|
-
...RESTRICTED_SYNTAX,
|
|
91
|
-
{
|
|
92
|
-
// ❌ useMemo(…, [])
|
|
93
|
-
selector: "CallExpression[callee.name=useMemo][arguments.1.type=ArrayExpression][arguments.1.elements.length=0]",
|
|
94
|
-
message: "`useMemo` with an empty dependency array can't provide a stable reference, use `useRef` instead."
|
|
95
|
-
}
|
|
96
|
-
];
|
|
97
|
-
var RESTRICTED_GLOBALS = [
|
|
98
|
-
"stop",
|
|
99
|
-
{ name: "isNaN", message: "Use Number.isNaN instead" }
|
|
100
|
-
];
|
|
101
|
-
var RESTRICTED_MODULES = [
|
|
102
|
-
{ name: "axios", message: "Use `fetch/node-fetch` instead." },
|
|
103
|
-
{ name: "moment", message: "Use `dayjs/date-fns` instead." },
|
|
104
|
-
{ name: "classnames", message: "Use `clsx` instead because it is faster." },
|
|
105
|
-
{
|
|
106
|
-
name: "lodash/isString.js",
|
|
107
|
-
message: "Use `typeof yourVar === 'string'` instead."
|
|
108
|
-
},
|
|
109
|
-
{ name: "lodash/isArray.js", message: "Use `Array.isArray` instead." },
|
|
110
|
-
{ name: "lodash/flatten.js", message: "Use `Array#flat()` instead." },
|
|
111
|
-
{
|
|
112
|
-
name: "lodash/compact.js",
|
|
113
|
-
message: "Use `Array#filter(Boolean)` instead."
|
|
114
|
-
},
|
|
115
|
-
{ name: "lodash/identity.js", message: "Use `(value) => value` instead." }
|
|
116
|
-
];
|
|
117
|
-
var JS_FILES = ["*.js?(x)", "*.mjs"];
|
|
118
|
-
var CODE_BLOCK = "**/*.md{,x}/*";
|
|
119
|
-
var CODE_FILE = "*.{,c,m}{j,t}s{,x}";
|
|
120
|
-
var TS_FILE = "*.{,c,m}ts{,x}";
|
|
121
|
-
|
|
122
|
-
// packages/eslint/src/base.ts
|
|
123
|
-
var config = {
|
|
124
|
-
parser: "@typescript-eslint/parser",
|
|
125
|
-
extends: [
|
|
126
|
-
"eslint:recommended",
|
|
127
|
-
"plugin:@typescript-eslint/recommended",
|
|
128
|
-
"prettier"
|
|
129
|
-
],
|
|
130
|
-
plugins: ["sonarjs", "unicorn", "promise", "import", "n"],
|
|
131
|
-
rules: {
|
|
132
|
-
// Disallows if statements as the only statement in else blocks
|
|
133
|
-
// https://eslint.org/docs/rules/no-lonely-if
|
|
134
|
-
"no-lonely-if": "error",
|
|
135
|
-
// Disallows the use of console
|
|
136
|
-
// https://eslint.org/docs/rules/no-console
|
|
137
|
-
"no-console": "error",
|
|
138
|
-
// Requires method and property shorthand syntax for object literals
|
|
139
|
-
// https://eslint.org/docs/rules/object-shorthand
|
|
140
|
-
"object-shorthand": ["error", "always"],
|
|
141
|
-
// Disallows loops with a body that allows only one iteration
|
|
142
|
-
// https://eslint.org/docs/rules/no-unreachable-loop
|
|
143
|
-
"no-unreachable-loop": "error",
|
|
144
|
-
"sonarjs/no-one-iteration-loop": "off",
|
|
145
|
-
// similar to 'no-unreachable-loop' but reports less cases
|
|
146
|
-
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
|
|
147
|
-
"sonarjs/no-unused-collection": "error",
|
|
148
|
-
"sonarjs/no-identical-conditions": "error",
|
|
149
|
-
"sonarjs/no-inverted-boolean-check": "error",
|
|
150
|
-
"sonarjs/no-use-of-empty-return-value": "error",
|
|
151
|
-
"sonarjs/no-gratuitous-expressions": "error",
|
|
152
|
-
"sonarjs/no-nested-switch": "error",
|
|
153
|
-
"unicorn/no-lonely-if": "error",
|
|
154
|
-
"sonarjs/no-collapsible-if": "off",
|
|
155
|
-
// same as 'unicorn/no-lonely-if'
|
|
156
|
-
"unicorn/no-array-push-push": "error",
|
|
157
|
-
"unicorn/no-instanceof-array": "error",
|
|
158
|
-
"unicorn/no-empty-file": "error",
|
|
159
|
-
"unicorn/no-useless-fallback-in-spread": "error",
|
|
160
|
-
"unicorn/prefer-array-find": "error",
|
|
161
|
-
"unicorn/no-useless-spread": "error",
|
|
162
|
-
"unicorn/prefer-includes": "error",
|
|
163
|
-
// Disallows specified syntax
|
|
164
|
-
// https://eslint.org/docs/rules/no-restricted-syntax
|
|
165
|
-
"no-restricted-syntax": ["error", ...RESTRICTED_SYNTAX],
|
|
166
|
-
"no-else-return": ["error", { allowElseIf: false }],
|
|
167
|
-
"promise/no-nesting": "error",
|
|
168
|
-
"import/extensions": ["error", "ignorePackages"],
|
|
169
|
-
// Bob when bundling requires to have `.js` extension
|
|
170
|
-
"import/no-default-export": "error",
|
|
171
|
-
"import/prefer-default-export": "off",
|
|
172
|
-
// disable opposite of 'import/no-default-export'
|
|
173
|
-
"unicorn/filename-case": "error",
|
|
174
|
-
"@typescript-eslint/no-unused-vars": [
|
|
175
|
-
"error",
|
|
176
|
-
{
|
|
177
|
-
argsIgnorePattern: "^_",
|
|
178
|
-
varsIgnorePattern: "^_"
|
|
179
|
-
// allow underscores in destructuring
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
// Enforce the style of numeric separators by correctly grouping digits
|
|
183
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
|
184
|
-
"unicorn/numeric-separators-style": "error",
|
|
185
|
-
// Prefer using the node: protocol when importing Node.js builtin modules
|
|
186
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
187
|
-
"unicorn/prefer-node-protocol": "error",
|
|
188
|
-
// Reports any imports that come after non-import statements
|
|
189
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
190
|
-
"import/first": "error",
|
|
191
|
-
// Disallow shorthand type conversions
|
|
192
|
-
// https://eslint.org/docs/latest/rules/no-implicit-coercion
|
|
193
|
-
"no-implicit-coercion": [
|
|
194
|
-
"error",
|
|
195
|
-
{
|
|
196
|
-
disallowTemplateShorthand: true,
|
|
197
|
-
// in TypeScript `!!` is preferable https://www.typescriptlang.org/docs/handbook/2/narrowing.html#truthiness-narrowing
|
|
198
|
-
boolean: false
|
|
199
|
-
}
|
|
200
|
-
],
|
|
201
|
-
// Disallow specified modules when loaded by `import` declarations
|
|
202
|
-
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
|
|
203
|
-
"n/no-restricted-import": ["error", RESTRICTED_MODULES],
|
|
204
|
-
// Disallow specified modules when loaded by require
|
|
205
|
-
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
|
|
206
|
-
"n/no-restricted-require": ["error", RESTRICTED_MODULES],
|
|
207
|
-
"no-restricted-modules": "off",
|
|
208
|
-
// deprecated in favor of corresponding rules from `eslint-plugin-n`
|
|
209
|
-
// Disallow specified global variables
|
|
210
|
-
// https://eslint.org/docs/latest/rules/no-restricted-globals
|
|
211
|
-
"no-restricted-globals": ["error", ...RESTRICTED_GLOBALS],
|
|
212
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
213
|
-
"prefer-const": ["error", { destructuring: "all" }],
|
|
214
|
-
"import/no-duplicates": "error",
|
|
215
|
-
"import/newline-after-import": "off",
|
|
216
|
-
// prettified by prettier-plugin-sort-imports
|
|
217
|
-
"prefer-object-has-own": "error",
|
|
218
|
-
"logical-assignment-operators": [
|
|
219
|
-
"error",
|
|
220
|
-
"always",
|
|
221
|
-
{ enforceForIfStatements: true }
|
|
222
|
-
],
|
|
223
|
-
yoda: "error",
|
|
224
|
-
"unicorn/prefer-export-from": ["error", { ignoreUsedVariables: true }],
|
|
225
|
-
"promise/no-multiple-resolved": "error",
|
|
226
|
-
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
227
|
-
"no-unused-expressions": "off",
|
|
228
|
-
"@typescript-eslint/no-unused-expressions": "error",
|
|
229
|
-
"no-negated-condition": "off",
|
|
230
|
-
"unicorn/no-negated-condition": "error",
|
|
231
|
-
// has autofix
|
|
232
|
-
"unicorn/no-array-for-each": "error",
|
|
233
|
-
"unicorn/prefer-string-trim-start-end": "error",
|
|
234
|
-
"no-self-compare": "error",
|
|
235
|
-
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
236
|
-
"import/no-useless-path-segments": "error",
|
|
237
|
-
// 'prefer-destructuring': [ // TODO: Rediscuss later
|
|
238
|
-
// 'error',
|
|
239
|
-
// {
|
|
240
|
-
// VariableDeclarator: { array: false, object: true },
|
|
241
|
-
// AssignmentExpression: { array: true, object: false },
|
|
242
|
-
// },
|
|
243
|
-
// { enforceForRenamedProperties: false },
|
|
244
|
-
// ],
|
|
245
|
-
"require-await": "off",
|
|
246
|
-
// Disallow async functions which have no await expression
|
|
247
|
-
// https://typescript-eslint.io/rules/require-await/
|
|
248
|
-
// '@typescript-eslint/require-await': 'error', // TODO: enable
|
|
249
|
-
"no-return-await": "off"
|
|
250
|
-
// Enforce consistent returning of awaited values.
|
|
251
|
-
// https://typescript-eslint.io/rules/return-await/
|
|
252
|
-
// '@typescript-eslint/return-await': 'error', // TODO: enable
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
// packages/eslint/src/json.ts
|
|
257
|
-
var JSONC_FILES = [
|
|
258
|
-
"tsconfig.json",
|
|
259
|
-
"tsconfig.base.json",
|
|
260
|
-
"nx.json",
|
|
261
|
-
".vscode/launch.json"
|
|
262
|
-
];
|
|
263
|
-
var config2 = {
|
|
264
|
-
root: true,
|
|
265
|
-
overrides: [
|
|
266
|
-
{
|
|
267
|
-
files: "*.json",
|
|
268
|
-
excludedFiles: JSONC_FILES,
|
|
269
|
-
extends: "plugin:jsonc/recommended-with-json"
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
"files": ["**/executors/**/schema.json", "**/generators/**/schema.json"],
|
|
273
|
-
"parser": "jsonc-eslint-parser",
|
|
274
|
-
"rules": {
|
|
275
|
-
"@nx/workspace/valid-schema-description": "error"
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
files: ["*.jsonc", ...JSONC_FILES],
|
|
280
|
-
extends: "plugin:jsonc/recommended-with-jsonc"
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
files: "*.json5",
|
|
284
|
-
extends: "plugin:jsonc/recommended-with-json5"
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
files: "*.json{,c,5}",
|
|
288
|
-
excludedFiles: CODE_BLOCK,
|
|
289
|
-
plugins: ["unicorn"],
|
|
290
|
-
rules: {
|
|
291
|
-
"unicorn/filename-case": "error"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
]
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// packages/eslint/src/next.ts
|
|
298
|
-
var babelOptions = {
|
|
299
|
-
presets: (() => {
|
|
300
|
-
try {
|
|
301
|
-
require.resolve("next/babel");
|
|
302
|
-
return ["next/babel"];
|
|
303
|
-
} catch (_e) {
|
|
304
|
-
return [];
|
|
305
|
-
}
|
|
306
|
-
})()
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
// packages/eslint/src/rules/react.ts
|
|
310
|
-
var config3 = {
|
|
311
|
-
// We recommend using TypeScript over `prop-types`, as `prop-types` can add
|
|
312
|
-
// to a project's build size.
|
|
313
|
-
"react/prop-types": "off",
|
|
314
|
-
// Disable requiring React to be imported, as this is no longer required.
|
|
315
|
-
"react/react-in-jsx-scope": "off",
|
|
316
|
-
/**
|
|
317
|
-
* Require an explicit type when using button elements.
|
|
318
|
-
*
|
|
319
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
320
|
-
*/
|
|
321
|
-
"react/button-has-type": "warn",
|
|
322
|
-
/**
|
|
323
|
-
* Require consistent function type for function components.
|
|
324
|
-
*
|
|
325
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/HEAD/docs/rules/function-component-definition.md
|
|
326
|
-
*/
|
|
327
|
-
"react/function-component-definition": "warn",
|
|
328
|
-
/**
|
|
329
|
-
* Require destructuring and symmetric naming of `useState` hook value and setter variables.
|
|
330
|
-
*
|
|
331
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
332
|
-
*/
|
|
333
|
-
"react/hook-use-state": "warn",
|
|
334
|
-
/**
|
|
335
|
-
* Require consistent boolean attributes notation in JSX.
|
|
336
|
-
*
|
|
337
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
338
|
-
*/
|
|
339
|
-
"react/jsx-boolean-value": "warn",
|
|
340
|
-
/**
|
|
341
|
-
* Disallow unnecessary curly braces in JSX props and children.
|
|
342
|
-
*
|
|
343
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
344
|
-
*/
|
|
345
|
-
"react/jsx-curly-brace-presence": "warn",
|
|
346
|
-
/**
|
|
347
|
-
* Require using shorthand form for React fragments, unless required.
|
|
348
|
-
*
|
|
349
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
350
|
-
*/
|
|
351
|
-
"react/jsx-fragments": "warn",
|
|
352
|
-
/**
|
|
353
|
-
* Prevent problematic leaked values from being rendered.
|
|
354
|
-
*
|
|
355
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
356
|
-
*/
|
|
357
|
-
"react/jsx-no-leaked-render": "warn",
|
|
358
|
-
/**
|
|
359
|
-
* Prevents usage of unsafe `target='_blank'`.
|
|
360
|
-
*
|
|
361
|
-
* This rule is a part of `react/recommended`, but we've modified it to
|
|
362
|
-
* allow referrer.
|
|
363
|
-
*
|
|
364
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
365
|
-
*/
|
|
366
|
-
"react/jsx-no-target-blank": [
|
|
367
|
-
"error",
|
|
368
|
-
{
|
|
369
|
-
allowReferrer: true
|
|
370
|
-
}
|
|
371
|
-
],
|
|
372
|
-
/**
|
|
373
|
-
* Disallow empty React fragments.
|
|
374
|
-
*
|
|
375
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
376
|
-
*/
|
|
377
|
-
"react/jsx-no-useless-fragment": ["warn", { allowExpressions: true }],
|
|
378
|
-
/**
|
|
379
|
-
* Require the use of PascalCase for user-defined JSX components.
|
|
380
|
-
*
|
|
381
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
382
|
-
*/
|
|
383
|
-
"react/jsx-pascal-case": "warn",
|
|
384
|
-
/**
|
|
385
|
-
* Require props to be sorted alphabetically.
|
|
386
|
-
*
|
|
387
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
388
|
-
*/
|
|
389
|
-
"react/jsx-sort-props": "warn",
|
|
390
|
-
/**
|
|
391
|
-
* Disallow usage of Array index in keys.
|
|
392
|
-
*
|
|
393
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
394
|
-
*/
|
|
395
|
-
"react/no-array-index-key": "warn",
|
|
396
|
-
/**
|
|
397
|
-
* Disallow creating unstable components inside components.
|
|
398
|
-
*
|
|
399
|
-
* 🚫 Not fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
|
|
400
|
-
*/
|
|
401
|
-
"react/no-unstable-nested-components": "error",
|
|
402
|
-
/**
|
|
403
|
-
* Disallow closing tags for components without children.
|
|
404
|
-
*
|
|
405
|
-
* 🔧 Fixable - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
406
|
-
*/
|
|
407
|
-
"react/self-closing-comp": "warn"
|
|
408
|
-
};
|
|
409
|
-
var react_default = config3;
|
|
410
|
-
|
|
411
|
-
// packages/eslint/src/rules/ts-docs.ts
|
|
412
|
-
var config4 = {
|
|
413
|
-
/**
|
|
414
|
-
* Require TSDoc comments conform to the TSDoc specification.
|
|
415
|
-
*
|
|
416
|
-
* 🚫 Not fixable - https://github.com/microsoft/tsdoc/tree/master/eslint-plugin
|
|
417
|
-
*/
|
|
418
|
-
"tsdoc/syntax": "error"
|
|
419
|
-
};
|
|
420
|
-
var ts_docs_default = config4;
|
|
421
|
-
|
|
422
|
-
// packages/eslint/src/react.ts
|
|
423
|
-
var config5 = {
|
|
424
|
-
root: true,
|
|
425
|
-
extends: [
|
|
426
|
-
"plugin:react/recommended",
|
|
427
|
-
"plugin:react-hooks/recommended",
|
|
428
|
-
"plugin:jsx-a11y/recommended",
|
|
429
|
-
"plugin:import/react",
|
|
430
|
-
"prettier"
|
|
431
|
-
],
|
|
432
|
-
settings: {
|
|
433
|
-
react: {
|
|
434
|
-
version: "detect"
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
rules: {
|
|
438
|
-
...ts_docs_default,
|
|
439
|
-
...react_default
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
// packages/eslint/src/rules/import.ts
|
|
444
|
-
var config6 = {
|
|
445
|
-
/**
|
|
446
|
-
* Disallow non-import statements appearing before import statements.
|
|
447
|
-
*
|
|
448
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
449
|
-
*/
|
|
450
|
-
"import/first": "error",
|
|
451
|
-
/**
|
|
452
|
-
* Require a newline after the last import/require.
|
|
453
|
-
*
|
|
454
|
-
* 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
|
|
455
|
-
*/
|
|
456
|
-
"import/newline-after-import": "warn",
|
|
457
|
-
/**
|
|
458
|
-
* Disallow import of modules using absolute paths.
|
|
459
|
-
*
|
|
460
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
|
|
461
|
-
*/
|
|
462
|
-
"import/no-absolute-path": "error",
|
|
463
|
-
/**
|
|
464
|
-
* Disallow cyclical dependencies between modules.
|
|
465
|
-
*
|
|
466
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
|
|
467
|
-
*/
|
|
468
|
-
"import/no-cycle": "error",
|
|
469
|
-
/**
|
|
470
|
-
* Disallow default exports.
|
|
471
|
-
*
|
|
472
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
473
|
-
*/
|
|
474
|
-
"import/no-default-export": "error",
|
|
475
|
-
/**
|
|
476
|
-
* Disallow the use of extraneous packages.
|
|
477
|
-
*
|
|
478
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
|
|
479
|
-
*/
|
|
480
|
-
"import/no-extraneous-dependencies": [
|
|
481
|
-
"error",
|
|
482
|
-
{ includeInternal: true, includeTypes: true }
|
|
483
|
-
],
|
|
484
|
-
/**
|
|
485
|
-
* Disallow mutable exports.
|
|
486
|
-
*
|
|
487
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
|
|
488
|
-
*/
|
|
489
|
-
"import/no-mutable-exports": "error",
|
|
490
|
-
/**
|
|
491
|
-
* Disallow importing packages through relative paths.
|
|
492
|
-
*
|
|
493
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
|
|
494
|
-
*/
|
|
495
|
-
"import/no-relative-packages": "warn",
|
|
496
|
-
/**
|
|
497
|
-
* Disallow a module from importing itself.
|
|
498
|
-
*
|
|
499
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
|
|
500
|
-
*/
|
|
501
|
-
"import/no-self-import": "error",
|
|
502
|
-
/**
|
|
503
|
-
* Ensures that there are no useless path segments.
|
|
504
|
-
*
|
|
505
|
-
* 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
|
|
506
|
-
*/
|
|
507
|
-
"import/no-useless-path-segments": ["error"],
|
|
508
|
-
/**
|
|
509
|
-
* Enforce a module import order convention.
|
|
510
|
-
*
|
|
511
|
-
* 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
|
|
512
|
-
*/
|
|
513
|
-
"import/order": [
|
|
514
|
-
"warn",
|
|
515
|
-
{
|
|
516
|
-
groups: [
|
|
517
|
-
"builtin",
|
|
518
|
-
// Node.js built-in modules
|
|
519
|
-
"external",
|
|
520
|
-
// Packages
|
|
521
|
-
"internal",
|
|
522
|
-
// Aliased modules
|
|
523
|
-
"parent",
|
|
524
|
-
// Relative parent
|
|
525
|
-
"sibling",
|
|
526
|
-
// Relative sibling
|
|
527
|
-
"index"
|
|
528
|
-
// Relative index
|
|
529
|
-
],
|
|
530
|
-
"newlines-between": "never"
|
|
531
|
-
}
|
|
532
|
-
]
|
|
533
|
-
};
|
|
534
|
-
var import_default = config6;
|
|
535
|
-
|
|
536
|
-
// packages/eslint/src/rules/storm.ts
|
|
537
|
-
var config7 = {
|
|
538
|
-
/**
|
|
539
|
-
* Require return statements in array methods callbacks.
|
|
540
|
-
*
|
|
541
|
-
* 🚫 Not fixable -https://eslint.org/docs/rules/array-callback-return
|
|
542
|
-
*/
|
|
543
|
-
"array-callback-return": ["error", { allowImplicit: true }],
|
|
544
|
-
/**
|
|
545
|
-
* Treat `var` statements as if they were block scoped.
|
|
546
|
-
*
|
|
547
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/block-scoped-var
|
|
548
|
-
*/
|
|
549
|
-
"block-scoped-var": "error",
|
|
550
|
-
/**
|
|
551
|
-
* Require curly braces for multiline blocks.
|
|
552
|
-
*
|
|
553
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/curly
|
|
554
|
-
*/
|
|
555
|
-
curly: ["warn", "multi-line"],
|
|
556
|
-
/**
|
|
557
|
-
* Require default clauses in switch statements to be last (if used).
|
|
558
|
-
*
|
|
559
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/default-case-last
|
|
560
|
-
*/
|
|
561
|
-
"default-case-last": "error",
|
|
562
|
-
/**
|
|
563
|
-
* Require triple equals (`===` and `!==`).
|
|
564
|
-
*
|
|
565
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/eqeqeq
|
|
566
|
-
*/
|
|
567
|
-
eqeqeq: "error",
|
|
568
|
-
/**
|
|
569
|
-
* Require grouped accessor pairs in object literals and classes.
|
|
570
|
-
*
|
|
571
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
572
|
-
*/
|
|
573
|
-
"grouped-accessor-pairs": "error",
|
|
574
|
-
/**
|
|
575
|
-
* Disallow use of `alert()`.
|
|
576
|
-
*
|
|
577
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-alert
|
|
578
|
-
*/
|
|
579
|
-
"no-alert": "error",
|
|
580
|
-
/**
|
|
581
|
-
* Disallow use of `caller`/`callee`.
|
|
582
|
-
*
|
|
583
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-caller
|
|
584
|
-
*/
|
|
585
|
-
"no-caller": "error",
|
|
586
|
-
/**
|
|
587
|
-
* Disallow returning value in constructor.
|
|
588
|
-
*
|
|
589
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-constructor-return
|
|
590
|
-
*/
|
|
591
|
-
"no-constructor-return": "error",
|
|
592
|
-
/**
|
|
593
|
-
* Disallow using an `else` if the `if` block contains a return.
|
|
594
|
-
*
|
|
595
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-else-return
|
|
596
|
-
*/
|
|
597
|
-
"no-else-return": "warn",
|
|
598
|
-
/**
|
|
599
|
-
* Disallow `eval()`.
|
|
600
|
-
*
|
|
601
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-eval
|
|
602
|
-
*/
|
|
603
|
-
"no-eval": "error",
|
|
604
|
-
/**
|
|
605
|
-
* Disallow extending native objects.
|
|
606
|
-
*
|
|
607
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-extend-native
|
|
608
|
-
*/
|
|
609
|
-
"no-extend-native": "error",
|
|
610
|
-
/**
|
|
611
|
-
* Disallow unnecessary function binding.
|
|
612
|
-
*
|
|
613
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-bind
|
|
614
|
-
*/
|
|
615
|
-
"no-extra-bind": "error",
|
|
616
|
-
/**
|
|
617
|
-
* Disallow unnecessary labels.
|
|
618
|
-
*
|
|
619
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-extra-label
|
|
620
|
-
*/
|
|
621
|
-
"no-extra-label": "error",
|
|
622
|
-
/**
|
|
623
|
-
* Disallow floating decimals.
|
|
624
|
-
*
|
|
625
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-floating-decimal
|
|
626
|
-
*/
|
|
627
|
-
"no-floating-decimal": "error",
|
|
628
|
-
/**
|
|
629
|
-
* Make people convert types explicitly e.g. `Boolean(foo)` instead of `!!foo`.
|
|
630
|
-
*
|
|
631
|
-
* 🔧 Partially Fixable - https://eslint.org/docs/rules/no-implicit-coercion
|
|
632
|
-
*/
|
|
633
|
-
"no-implicit-coercion": "error",
|
|
634
|
-
/**
|
|
635
|
-
* Disallow use of `eval()`-like methods.
|
|
636
|
-
*
|
|
637
|
-
* https://eslint.org/docs/rules/no-implied-eval
|
|
638
|
-
*/
|
|
639
|
-
"no-implied-eval": "error",
|
|
640
|
-
/**
|
|
641
|
-
* Disallow usage of `__iterator__` property.
|
|
642
|
-
*
|
|
643
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-iterator
|
|
644
|
-
*/
|
|
645
|
-
"no-iterator": "error",
|
|
646
|
-
/**
|
|
647
|
-
* Disallow use of labels for anything other than loops and switches.
|
|
648
|
-
*
|
|
649
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-labels
|
|
650
|
-
*/
|
|
651
|
-
"no-labels": ["error"],
|
|
652
|
-
/**
|
|
653
|
-
* Disallow unnecessary nested blocks.
|
|
654
|
-
*
|
|
655
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-lone-blocks
|
|
656
|
-
*/
|
|
657
|
-
"no-lone-blocks": "error",
|
|
658
|
-
/**
|
|
659
|
-
* Disallow `new` for side effects.
|
|
660
|
-
*
|
|
661
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new
|
|
662
|
-
*/
|
|
663
|
-
"no-new": "error",
|
|
664
|
-
/**
|
|
665
|
-
* Disallow function constructors.
|
|
666
|
-
*
|
|
667
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-func
|
|
668
|
-
*/
|
|
669
|
-
"no-new-func": "error",
|
|
670
|
-
/**
|
|
671
|
-
* Disallow base types wrapper instances, such as `new String('foo')`.
|
|
672
|
-
*
|
|
673
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-new-wrappers
|
|
674
|
-
*/
|
|
675
|
-
"no-new-wrappers": "error",
|
|
676
|
-
/**
|
|
677
|
-
* Disallow use of octal escape sequences in string literals.
|
|
678
|
-
*
|
|
679
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-octal-escape
|
|
680
|
-
*/
|
|
681
|
-
"no-octal-escape": "error",
|
|
682
|
-
/**
|
|
683
|
-
* Disallow reassignment of function parameters.
|
|
684
|
-
*
|
|
685
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-param-reassign
|
|
686
|
-
*/
|
|
687
|
-
"no-param-reassign": "error",
|
|
688
|
-
/**
|
|
689
|
-
* Disallow usage of the deprecated `__proto__` property.
|
|
690
|
-
*
|
|
691
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-proto
|
|
692
|
-
*/
|
|
693
|
-
"no-proto": "error",
|
|
694
|
-
/**
|
|
695
|
-
* Disallow assignment in `return` statement.
|
|
696
|
-
*
|
|
697
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-assign
|
|
698
|
-
*/
|
|
699
|
-
"no-return-assign": "error",
|
|
700
|
-
/**
|
|
701
|
-
* Disallows unnecessary `return await`.
|
|
702
|
-
*
|
|
703
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-return-await
|
|
704
|
-
*/
|
|
705
|
-
"no-return-await": "error",
|
|
706
|
-
/**
|
|
707
|
-
* Disallow use of `javascript:` urls.
|
|
708
|
-
*
|
|
709
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-script-url
|
|
710
|
-
*/
|
|
711
|
-
"no-script-url": "error",
|
|
712
|
-
/**
|
|
713
|
-
* Disallow comparisons where both sides are exactly the same.
|
|
714
|
-
*
|
|
715
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-self-compare
|
|
716
|
-
*/
|
|
717
|
-
"no-self-compare": "error",
|
|
718
|
-
/**
|
|
719
|
-
* Disallow use of comma operator.
|
|
720
|
-
*
|
|
721
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-sequences
|
|
722
|
-
*/
|
|
723
|
-
"no-sequences": "error",
|
|
724
|
-
/**
|
|
725
|
-
* Disallow unnecessary `.call()` and `.apply()`.
|
|
726
|
-
*
|
|
727
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-call
|
|
728
|
-
*/
|
|
729
|
-
"no-useless-call": "error",
|
|
730
|
-
/**
|
|
731
|
-
* Disallow unnecessary concatenation of strings.
|
|
732
|
-
*
|
|
733
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/no-useless-concat
|
|
734
|
-
*/
|
|
735
|
-
"no-useless-concat": "error",
|
|
736
|
-
/**
|
|
737
|
-
* Disallow redundant return statements.
|
|
738
|
-
*
|
|
739
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/no-useless-return
|
|
740
|
-
*/
|
|
741
|
-
"no-useless-return": "warn",
|
|
742
|
-
/**
|
|
743
|
-
* Require using named capture groups in regular expressions.
|
|
744
|
-
*
|
|
745
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-named-capture-group
|
|
746
|
-
*/
|
|
747
|
-
"prefer-named-capture-group": "error",
|
|
748
|
-
/**
|
|
749
|
-
* Require using Error objects as Promise rejection reasons.
|
|
750
|
-
*
|
|
751
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
752
|
-
*/
|
|
753
|
-
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
754
|
-
/**
|
|
755
|
-
* Disallow use of the RegExp constructor in favor of regular expression
|
|
756
|
-
* literals.
|
|
757
|
-
*
|
|
758
|
-
* 🚫 Not fixable - https://eslint.org/docs/rules/prefer-regex-literals
|
|
759
|
-
*/
|
|
760
|
-
"prefer-regex-literals": "error",
|
|
761
|
-
/**
|
|
762
|
-
* Disallow "Yoda conditions", ensuring the comparison.
|
|
763
|
-
*
|
|
764
|
-
* 🔧 Fixable - https://eslint.org/docs/rules/yoda
|
|
765
|
-
*/
|
|
766
|
-
yoda: "warn"
|
|
767
|
-
};
|
|
768
|
-
var storm_default = config7;
|
|
769
|
-
|
|
770
|
-
// packages/eslint/src/rules/unicorn.ts
|
|
771
|
-
var config8 = {
|
|
772
|
-
/**
|
|
773
|
-
* Require consistent filename case for all linted files.
|
|
774
|
-
*
|
|
775
|
-
* 🚫 Not fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
776
|
-
*/
|
|
777
|
-
"unicorn/filename-case": [
|
|
778
|
-
"error",
|
|
779
|
-
{
|
|
780
|
-
case: "kebabCase"
|
|
781
|
-
}
|
|
782
|
-
],
|
|
783
|
-
/**
|
|
784
|
-
* Require using the `node:` protocol when importing Node.js built-in modules.
|
|
785
|
-
*
|
|
786
|
-
* 🔧 Fixable - https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
787
|
-
*/
|
|
788
|
-
"unicorn/prefer-node-protocol": "warn"
|
|
789
|
-
};
|
|
790
|
-
var unicorn_default = config8;
|
|
791
|
-
|
|
792
|
-
// packages/eslint/src/javascript.ts
|
|
793
|
-
var config9 = {
|
|
794
|
-
overrides: [
|
|
795
|
-
{
|
|
796
|
-
files: ["*.js", "*.jsx"],
|
|
797
|
-
extends: ["plugin:@nx/javascript"],
|
|
798
|
-
plugins: ["unicorn", "import"],
|
|
799
|
-
rules: {
|
|
800
|
-
...import_default,
|
|
801
|
-
...unicorn_default,
|
|
802
|
-
...storm_default
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
]
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
// packages/eslint/src/typescript.ts
|
|
809
|
-
var config10 = {
|
|
810
|
-
root: true,
|
|
811
|
-
overrides: [
|
|
812
|
-
{
|
|
813
|
-
files: ["*.ts", "*.tsx"],
|
|
814
|
-
extends: ["plugin:@nx/typescript"],
|
|
815
|
-
rules: {}
|
|
816
|
-
}
|
|
817
|
-
],
|
|
818
|
-
parser: "@typescript-eslint/parser",
|
|
819
|
-
extends: [
|
|
820
|
-
"eslint:recommended",
|
|
821
|
-
"plugin:@typescript-eslint/recommended",
|
|
822
|
-
"prettier"
|
|
823
|
-
],
|
|
824
|
-
plugins: ["sonarjs", "unicorn", "promise", "import", "eslint-plugin-tsdoc"],
|
|
825
|
-
rules: {
|
|
826
|
-
// Disallows if statements as the only statement in else blocks
|
|
827
|
-
// https://eslint.org/docs/rules/no-lonely-if
|
|
828
|
-
"no-lonely-if": "error",
|
|
829
|
-
// Disallows the use of console
|
|
830
|
-
// https://eslint.org/docs/rules/no-console
|
|
831
|
-
"no-console": "error",
|
|
832
|
-
// Requires method and property shorthand syntax for object literals
|
|
833
|
-
// https://eslint.org/docs/rules/object-shorthand
|
|
834
|
-
"object-shorthand": ["error", "always"],
|
|
835
|
-
// Disallows loops with a body that allows only one iteration
|
|
836
|
-
// https://eslint.org/docs/rules/no-unreachable-loop
|
|
837
|
-
"no-unreachable-loop": "error",
|
|
838
|
-
"sonarjs/no-one-iteration-loop": "off",
|
|
839
|
-
// similar to 'no-unreachable-loop' but reports less cases
|
|
840
|
-
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
|
|
841
|
-
"sonarjs/no-unused-collection": "error",
|
|
842
|
-
"sonarjs/no-identical-conditions": "error",
|
|
843
|
-
"sonarjs/no-inverted-boolean-check": "error",
|
|
844
|
-
"sonarjs/no-use-of-empty-return-value": "error",
|
|
845
|
-
"sonarjs/no-gratuitous-expressions": "error",
|
|
846
|
-
"sonarjs/no-nested-switch": "error",
|
|
847
|
-
"unicorn/no-lonely-if": "error",
|
|
848
|
-
"sonarjs/no-collapsible-if": "off",
|
|
849
|
-
// same as 'unicorn/no-lonely-if'
|
|
850
|
-
"unicorn/no-array-push-push": "error",
|
|
851
|
-
"unicorn/no-instanceof-array": "error",
|
|
852
|
-
"unicorn/no-empty-file": "error",
|
|
853
|
-
"unicorn/no-useless-fallback-in-spread": "error",
|
|
854
|
-
"unicorn/prefer-array-find": "error",
|
|
855
|
-
"unicorn/no-useless-spread": "error",
|
|
856
|
-
"unicorn/prefer-includes": "error",
|
|
857
|
-
// Disallows specified syntax
|
|
858
|
-
// https://eslint.org/docs/rules/no-restricted-syntax
|
|
859
|
-
"no-restricted-syntax": ["error", ...RESTRICTED_SYNTAX],
|
|
860
|
-
"no-else-return": ["error", { allowElseIf: false }],
|
|
861
|
-
"promise/no-nesting": "error",
|
|
862
|
-
"import/extensions": ["error", "ignorePackages"],
|
|
863
|
-
// Bob when bundling requires to have `.js` extension
|
|
864
|
-
"import/no-default-export": "error",
|
|
865
|
-
"import/prefer-default-export": "off",
|
|
866
|
-
// disable opposite of 'import/no-default-export'
|
|
867
|
-
"unicorn/filename-case": "error",
|
|
868
|
-
"@typescript-eslint/no-unused-vars": [
|
|
869
|
-
"error",
|
|
870
|
-
{
|
|
871
|
-
argsIgnorePattern: "^_",
|
|
872
|
-
varsIgnorePattern: "^_"
|
|
873
|
-
// allow underscores in destructuring
|
|
874
|
-
}
|
|
875
|
-
],
|
|
876
|
-
// Enforce the style of numeric separators by correctly grouping digits
|
|
877
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/numeric-separators-style.md
|
|
878
|
-
"unicorn/numeric-separators-style": "error",
|
|
879
|
-
// Prefer using the node: protocol when importing Node.js builtin modules
|
|
880
|
-
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md
|
|
881
|
-
"unicorn/prefer-node-protocol": "error",
|
|
882
|
-
// Reports any imports that come after non-import statements
|
|
883
|
-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
884
|
-
"import/first": "error",
|
|
885
|
-
// Disallow shorthand type conversions
|
|
886
|
-
// https://eslint.org/docs/latest/rules/no-implicit-coercion
|
|
887
|
-
"no-implicit-coercion": [
|
|
888
|
-
"error",
|
|
889
|
-
{
|
|
890
|
-
disallowTemplateShorthand: true,
|
|
891
|
-
// in TypeScript `!!` is preferable https://www.typescriptlang.org/docs/handbook/2/narrowing.html#truthiness-narrowing
|
|
892
|
-
boolean: false
|
|
893
|
-
}
|
|
894
|
-
],
|
|
895
|
-
// Disallow specified modules when loaded by `import` declarations
|
|
896
|
-
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
|
|
897
|
-
"n/no-restricted-import": ["error", RESTRICTED_MODULES],
|
|
898
|
-
// Disallow specified modules when loaded by require
|
|
899
|
-
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
|
|
900
|
-
"n/no-restricted-require": ["error", RESTRICTED_MODULES],
|
|
901
|
-
"no-restricted-modules": "off",
|
|
902
|
-
// deprecated in favor of corresponding rules from `eslint-plugin-n`
|
|
903
|
-
// Disallow specified global variables
|
|
904
|
-
// https://eslint.org/docs/latest/rules/no-restricted-globals
|
|
905
|
-
"no-restricted-globals": ["error", ...RESTRICTED_GLOBALS],
|
|
906
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
907
|
-
"prefer-const": ["error", { destructuring: "all" }],
|
|
908
|
-
"import/no-duplicates": "error",
|
|
909
|
-
"import/newline-after-import": "off",
|
|
910
|
-
// prettified by prettier-plugin-sort-imports
|
|
911
|
-
"prefer-object-has-own": "error",
|
|
912
|
-
"logical-assignment-operators": [
|
|
913
|
-
"error",
|
|
914
|
-
"always",
|
|
915
|
-
{ enforceForIfStatements: true }
|
|
916
|
-
],
|
|
917
|
-
"@typescript-eslint/prefer-optional-chain": "error",
|
|
918
|
-
yoda: "error",
|
|
919
|
-
"unicorn/prefer-export-from": ["error", { ignoreUsedVariables: true }],
|
|
920
|
-
"promise/no-multiple-resolved": "error",
|
|
921
|
-
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
922
|
-
"no-unused-expressions": "off",
|
|
923
|
-
"@typescript-eslint/no-unused-expressions": "error",
|
|
924
|
-
"no-negated-condition": "off",
|
|
925
|
-
"unicorn/no-negated-condition": "error",
|
|
926
|
-
"unicorn/no-array-for-each": "error",
|
|
927
|
-
"unicorn/prefer-string-trim-start-end": "error",
|
|
928
|
-
"no-self-compare": "error",
|
|
929
|
-
eqeqeq: ["error", "always", { null: "ignore" }],
|
|
930
|
-
"import/no-useless-path-segments": "error",
|
|
931
|
-
"require-await": "off",
|
|
932
|
-
"no-return-await": "off",
|
|
933
|
-
...import_default,
|
|
934
|
-
...unicorn_default,
|
|
935
|
-
...ts_docs_default,
|
|
936
|
-
...storm_default
|
|
937
|
-
}
|
|
938
|
-
};
|
|
939
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
940
|
-
0 && (module.exports = {
|
|
941
|
-
CODE_BLOCK,
|
|
942
|
-
CODE_FILE,
|
|
943
|
-
JS_FILES,
|
|
944
|
-
REACT_RESTRICTED_SYNTAX,
|
|
945
|
-
RESTRICTED_GLOBALS,
|
|
946
|
-
RESTRICTED_MODULES,
|
|
947
|
-
RESTRICTED_SYNTAX,
|
|
948
|
-
TS_FILE
|
|
949
|
-
});
|