@newsteam/eslint-config 1.2.16 → 1.2.17
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -49
- package/dist/plugins/sort-react-dependency-arrays.d.ts +3 -2
- package/dist/plugins/sort-react-dependency-arrays.d.ts.map +1 -1
- package/dist/plugins/sort-react-dependency-arrays.js +95 -18
- package/dist/rules/array-function.d.ts +3 -0
- package/dist/rules/array-function.d.ts.map +1 -0
- package/dist/rules/array-function.js +56 -0
- package/dist/rules/css-modules.d.ts +3 -0
- package/dist/rules/css-modules.d.ts.map +1 -0
- package/dist/rules/css-modules.js +27 -0
- package/dist/rules/destructuring.d.ts +3 -0
- package/dist/rules/destructuring.d.ts.map +1 -0
- package/dist/rules/destructuring.js +39 -0
- package/dist/rules/eslint-comments.d.ts +3 -0
- package/dist/rules/eslint-comments.d.ts.map +1 -0
- package/dist/rules/eslint-comments.js +77 -0
- package/dist/rules/import-newlines.d.ts +3 -0
- package/dist/rules/import-newlines.d.ts.map +1 -0
- package/dist/rules/import-newlines.js +26 -0
- package/dist/rules/import-x.d.ts +3 -0
- package/dist/rules/import-x.d.ts.map +1 -0
- package/dist/rules/import-x.js +420 -0
- package/dist/{rules.d.ts → rules/index.d.ts} +1 -1
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/{rules.js → rules/index.js} +51 -1
- package/dist/rules/next.d.ts +3 -0
- package/dist/rules/next.d.ts.map +1 -0
- package/dist/rules/next.js +140 -0
- package/dist/rules/no-unsanitized.d.ts +3 -0
- package/dist/rules/no-unsanitized.d.ts.map +1 -0
- package/dist/rules/no-unsanitized.js +38 -0
- package/dist/rules/no-useless-assign.d.ts +3 -0
- package/dist/rules/no-useless-assign.d.ts.map +1 -0
- package/dist/rules/no-useless-assign.js +20 -0
- package/dist/rules/node.d.ts +3 -0
- package/dist/rules/node.d.ts.map +1 -0
- package/dist/rules/node.js +305 -0
- package/dist/rules/perfectionist.d.ts +3 -0
- package/dist/rules/perfectionist.d.ts.map +1 -0
- package/dist/rules/perfectionist.js +94 -0
- package/dist/rules/promise.d.ts +3 -0
- package/dist/rules/promise.d.ts.map +1 -0
- package/dist/rules/promise.js +123 -0
- package/dist/rules/react-19-upgrade.d.ts +3 -0
- package/dist/rules/react-19-upgrade.d.ts.map +1 -0
- package/dist/rules/react-19-upgrade.js +20 -0
- package/dist/rules/react-compiler.d.ts +3 -0
- package/dist/rules/react-compiler.d.ts.map +1 -0
- package/dist/{plugins → rules}/react-compiler.js +7 -9
- package/dist/rules/react-hooks.d.ts +3 -0
- package/dist/rules/react-hooks.d.ts.map +1 -0
- package/dist/rules/react-hooks.js +163 -0
- package/dist/rules/react-perf.d.ts +3 -0
- package/dist/rules/react-perf.d.ts.map +1 -0
- package/dist/rules/react-perf.js +47 -0
- package/dist/rules/react-refresh.d.ts +3 -0
- package/dist/rules/react-refresh.d.ts.map +1 -0
- package/dist/rules/react-refresh.js +19 -0
- package/dist/rules/react.d.ts +3 -0
- package/dist/rules/react.d.ts.map +1 -0
- package/dist/rules/react.js +740 -0
- package/dist/rules/security.d.ts +3 -0
- package/dist/rules/security.d.ts.map +1 -0
- package/dist/rules/security.js +112 -0
- package/dist/rules/sort-react-dependency-arrays.d.ts +3 -0
- package/dist/rules/sort-react-dependency-arrays.d.ts.map +1 -0
- package/dist/rules/sort-react-dependency-arrays.js +12 -0
- package/dist/rules/stylistic.d.ts +3 -0
- package/dist/rules/stylistic.d.ts.map +1 -0
- package/dist/rules/stylistic.js +916 -0
- package/dist/rules/typescript.d.ts +3 -0
- package/dist/rules/typescript.d.ts.map +1 -0
- package/dist/{plugins → rules}/typescript.js +1 -1
- package/dist/rules/unicorn.d.ts +3 -0
- package/dist/rules/unicorn.d.ts.map +1 -0
- package/dist/rules/unicorn.js +998 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/package.json +9 -11
- package/dist/plugins/array-function.d.ts +0 -3
- package/dist/plugins/array-function.d.ts.map +0 -1
- package/dist/plugins/array-function.js +0 -58
- package/dist/plugins/css-modules.d.ts +0 -3
- package/dist/plugins/css-modules.d.ts.map +0 -1
- package/dist/plugins/css-modules.js +0 -19
- package/dist/plugins/destructuring.d.ts +0 -3
- package/dist/plugins/destructuring.d.ts.map +0 -1
- package/dist/plugins/destructuring.js +0 -41
- package/dist/plugins/eslint-comments.d.ts +0 -3
- package/dist/plugins/eslint-comments.d.ts.map +0 -1
- package/dist/plugins/eslint-comments.js +0 -79
- package/dist/plugins/import-newlines.d.ts +0 -3
- package/dist/plugins/import-newlines.d.ts.map +0 -1
- package/dist/plugins/import-newlines.js +0 -28
- package/dist/plugins/import-x.d.ts +0 -3
- package/dist/plugins/import-x.d.ts.map +0 -1
- package/dist/plugins/import-x.js +0 -418
- package/dist/plugins/newline-destructuring.d.ts +0 -3
- package/dist/plugins/newline-destructuring.d.ts.map +0 -1
- package/dist/plugins/newline-destructuring.js +0 -26
- package/dist/plugins/next.d.ts +0 -3
- package/dist/plugins/next.d.ts.map +0 -1
- package/dist/plugins/next.js +0 -142
- package/dist/plugins/no-unsanitized.d.ts +0 -3
- package/dist/plugins/no-unsanitized.d.ts.map +0 -1
- package/dist/plugins/no-unsanitized.js +0 -40
- package/dist/plugins/no-useless-assign.d.ts +0 -3
- package/dist/plugins/no-useless-assign.d.ts.map +0 -1
- package/dist/plugins/no-useless-assign.js +0 -22
- package/dist/plugins/node.d.ts +0 -3
- package/dist/plugins/node.d.ts.map +0 -1
- package/dist/plugins/node.js +0 -307
- package/dist/plugins/perfectionist.d.ts +0 -3
- package/dist/plugins/perfectionist.d.ts.map +0 -1
- package/dist/plugins/perfectionist.js +0 -96
- package/dist/plugins/promise.d.ts +0 -3
- package/dist/plugins/promise.d.ts.map +0 -1
- package/dist/plugins/promise.js +0 -125
- package/dist/plugins/react-19-upgrade.d.ts +0 -3
- package/dist/plugins/react-19-upgrade.d.ts.map +0 -1
- package/dist/plugins/react-19-upgrade.js +0 -22
- package/dist/plugins/react-compiler.d.ts +0 -3
- package/dist/plugins/react-compiler.d.ts.map +0 -1
- package/dist/plugins/react-hooks.d.ts +0 -3
- package/dist/plugins/react-hooks.d.ts.map +0 -1
- package/dist/plugins/react-hooks.js +0 -165
- package/dist/plugins/react-perf.d.ts +0 -3
- package/dist/plugins/react-perf.d.ts.map +0 -1
- package/dist/plugins/react-perf.js +0 -49
- package/dist/plugins/react-refresh.d.ts +0 -3
- package/dist/plugins/react-refresh.d.ts.map +0 -1
- package/dist/plugins/react-refresh.js +0 -21
- package/dist/plugins/react.d.ts +0 -3
- package/dist/plugins/react.d.ts.map +0 -1
- package/dist/plugins/react.js +0 -738
- package/dist/plugins/security.d.ts +0 -3
- package/dist/plugins/security.d.ts.map +0 -1
- package/dist/plugins/security.js +0 -114
- package/dist/plugins/stylistic.d.ts +0 -3
- package/dist/plugins/stylistic.d.ts.map +0 -1
- package/dist/plugins/stylistic.js +0 -918
- package/dist/plugins/typescript.d.ts +0 -3
- package/dist/plugins/typescript.d.ts.map +0 -1
- package/dist/plugins/unicorn.d.ts +0 -3
- package/dist/plugins/unicorn.d.ts.map +0 -1
- package/dist/plugins/unicorn.js +0 -1000
- package/dist/rules.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA6CrC,QAAA,MAAM,MAAM,EAAE,MAAM,CAAC,MAAM,EAoGzB,CAAC;AAGH,eAAe,MAAM,CAAC;AAGtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,30 +15,7 @@ import { createNodeResolver } from "eslint-plugin-import-x";
|
|
|
15
15
|
import { defineConfig } from "eslint/config";
|
|
16
16
|
import global from "globals";
|
|
17
17
|
import tseslint from "typescript-eslint";
|
|
18
|
-
import {
|
|
19
|
-
import { cssModulesPlugin } from "./plugins/css-modules.js";
|
|
20
|
-
import { destructuringPlugin } from "./plugins/destructuring.js";
|
|
21
|
-
import { eslintCommentsPlugin } from "./plugins/eslint-comments.js";
|
|
22
|
-
import { importNewlinesPlugin } from "./plugins/import-newlines.js";
|
|
23
|
-
import { importXPlugin } from "./plugins/import-x.js";
|
|
24
|
-
import { newlineDestructuringPlugin } from "./plugins/newline-destructuring.js";
|
|
25
|
-
import { noUnsanitizedPlugin } from "./plugins/no-unsanitized.js";
|
|
26
|
-
import { noUselessAssignPlugin } from "./plugins/no-useless-assign.js";
|
|
27
|
-
import { nodePlugin } from "./plugins/node.js";
|
|
28
|
-
import { perfectionistPlugin } from "./plugins/perfectionist.js";
|
|
29
|
-
import { promisePlugin } from "./plugins/promise.js";
|
|
30
|
-
import { react19UpgradePlugin } from "./plugins/react-19-upgrade.js";
|
|
31
|
-
import { reactCompilerPlugin } from "./plugins/react-compiler.js";
|
|
32
|
-
import { reactHooksPlugin } from "./plugins/react-hooks.js";
|
|
33
|
-
import { reactPerfPlugin } from "./plugins/react-perf.js";
|
|
34
|
-
import { reactRefreshPlugin } from "./plugins/react-refresh.js";
|
|
35
|
-
import { reactPlugin } from "./plugins/react.js";
|
|
36
|
-
import { securityPlugin } from "./plugins/security.js";
|
|
37
|
-
import { sortReactDependenyArraysPlugin } from "./plugins/sort-react-dependency-arrays.js";
|
|
38
|
-
import { stylisticPlugin } from "./plugins/stylistic.js";
|
|
39
|
-
import { typescriptPlugin } from "./plugins/typescript.js";
|
|
40
|
-
import { unicornPlugin } from "./plugins/unicorn.js";
|
|
41
|
-
import { rules } from "./rules.js";
|
|
18
|
+
import { rules } from "./rules/index.js";
|
|
42
19
|
import { REACT_VERSION } from "./settings.js";
|
|
43
20
|
const globals = {
|
|
44
21
|
...global.browser,
|
|
@@ -86,30 +63,6 @@ const config = defineConfig([
|
|
|
86
63
|
settings,
|
|
87
64
|
},
|
|
88
65
|
...rules,
|
|
89
|
-
// Always place plugins after rules in case there are overrides (e.g. in the typescriptPlugin)
|
|
90
|
-
...arrayFuncPlugin,
|
|
91
|
-
...cssModulesPlugin,
|
|
92
|
-
...destructuringPlugin,
|
|
93
|
-
...eslintCommentsPlugin,
|
|
94
|
-
...importNewlinesPlugin,
|
|
95
|
-
...importXPlugin,
|
|
96
|
-
...newlineDestructuringPlugin,
|
|
97
|
-
...noUnsanitizedPlugin,
|
|
98
|
-
...noUselessAssignPlugin,
|
|
99
|
-
...nodePlugin,
|
|
100
|
-
...perfectionistPlugin,
|
|
101
|
-
...promisePlugin,
|
|
102
|
-
...react19UpgradePlugin,
|
|
103
|
-
...reactCompilerPlugin,
|
|
104
|
-
...reactHooksPlugin,
|
|
105
|
-
...reactPerfPlugin,
|
|
106
|
-
...reactPlugin,
|
|
107
|
-
...reactRefreshPlugin,
|
|
108
|
-
...securityPlugin,
|
|
109
|
-
...sortReactDependenyArraysPlugin,
|
|
110
|
-
...stylisticPlugin,
|
|
111
|
-
...typescriptPlugin,
|
|
112
|
-
...unicornPlugin,
|
|
113
66
|
{
|
|
114
67
|
files: [
|
|
115
68
|
"**/*.d.ts",
|
|
@@ -198,4 +151,4 @@ const config = defineConfig([
|
|
|
198
151
|
},
|
|
199
152
|
]);
|
|
200
153
|
export default config;
|
|
201
|
-
export {
|
|
154
|
+
export { nextPluginConfig } from "./rules/next.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ESLint } from "eslint";
|
|
2
|
+
declare const _default: ESLint.Plugin;
|
|
3
|
+
export default _default;
|
|
3
4
|
//# sourceMappingURL=sort-react-dependency-arrays.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-react-dependency-arrays.d.ts","sourceRoot":"","sources":["../../src/plugins/sort-react-dependency-arrays.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sort-react-dependency-arrays.d.ts","sourceRoot":"","sources":["../../src/plugins/sort-react-dependency-arrays.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;wBAoJZ,MAAM,CAAC,MAAM;AAAtC,wBAAuC"}
|
|
@@ -1,21 +1,98 @@
|
|
|
1
|
-
import sortReactDependenyArrays from "eslint-plugin-sort-react-dependency-arrays";
|
|
2
1
|
/*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
|
|
3
|
+
This is a port of eslint-plugin-sort-react-dependency-arrays because it looked simple and
|
|
4
|
+
I couldn't be asked to fork it or contribute to open source. Forgive me.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
import { AST_NODE_TYPES } from "@typescript-eslint/utils";
|
|
8
|
+
const HOOKS = [
|
|
9
|
+
"useCallback",
|
|
10
|
+
"useEffect",
|
|
11
|
+
"useLayoutEffect",
|
|
12
|
+
"useMemo",
|
|
13
|
+
];
|
|
14
|
+
const isDependencyArrayHook = (node) => node.type === AST_NODE_TYPES.Identifier && HOOKS.includes(node.name);
|
|
15
|
+
const plugin = {
|
|
16
|
+
meta: {
|
|
17
|
+
name: "eslint-plugin-sort-react-dependency-arrays",
|
|
18
|
+
version: "1.0.0",
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
sort: {
|
|
22
|
+
create(context) {
|
|
23
|
+
const { sourceCode } = context;
|
|
24
|
+
const getSortableNameFromNode = (node) => {
|
|
25
|
+
if (!node) {
|
|
26
|
+
return "";
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- it's ok in this case, default is taking care of it
|
|
29
|
+
switch (node.type) {
|
|
30
|
+
case AST_NODE_TYPES.Identifier: {
|
|
31
|
+
return node.name;
|
|
32
|
+
}
|
|
33
|
+
case AST_NODE_TYPES.Literal: {
|
|
34
|
+
return String(node.value);
|
|
35
|
+
}
|
|
36
|
+
case AST_NODE_TYPES.MemberExpression: {
|
|
37
|
+
return `${getSortableNameFromNode(node.object)}.${getSortableNameFromNode(node.property)}`;
|
|
38
|
+
}
|
|
39
|
+
default: {
|
|
40
|
+
return sourceCode.getText(node);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
CallExpression(node) {
|
|
46
|
+
if (isDependencyArrayHook(node.callee)) {
|
|
47
|
+
const [, dependencies] = node.arguments;
|
|
48
|
+
if (dependencies?.type === AST_NODE_TYPES.ArrayExpression
|
|
49
|
+
&& dependencies.elements.length > 1) {
|
|
50
|
+
// 1. Map elements to their sortable names AND their raw source text
|
|
51
|
+
const elementsWithMetadata = dependencies.elements
|
|
52
|
+
.map((element) => {
|
|
53
|
+
if (!element) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
name: getSortableNameFromNode(element),
|
|
58
|
+
originalNode: element,
|
|
59
|
+
// sourceCode.getText(el) gets the exact text of that element
|
|
60
|
+
source: sourceCode.getText(element),
|
|
61
|
+
};
|
|
62
|
+
})
|
|
63
|
+
.filter((item) => item !== undefined);
|
|
64
|
+
const currentNames = elementsWithMetadata.map((element) => element.name);
|
|
65
|
+
// 2. Create the sorted version
|
|
66
|
+
// eslint-disable-next-line unicorn/no-array-sort -- nah this causes down stream issues
|
|
67
|
+
const sortedMetadata = [...elementsWithMetadata].sort((itemA, itemB) => itemA.name.toLowerCase().localeCompare(itemB.name.toLowerCase()));
|
|
68
|
+
const sortedNames = sortedMetadata.map((element) => element.name);
|
|
69
|
+
// 3. Check if sorting changed anything
|
|
70
|
+
if (JSON.stringify(currentNames) !== JSON.stringify(sortedNames)) {
|
|
71
|
+
context.report({
|
|
72
|
+
fix: (fixer) => elementsWithMetadata.map((original, index) => fixer.replaceText(original.originalNode, sortedMetadata[index].source)),
|
|
73
|
+
messageId: "sortDependencies",
|
|
74
|
+
node: dependencies,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
meta: {
|
|
83
|
+
docs: {
|
|
84
|
+
description: "Sort React dependency arrays alphabetically",
|
|
85
|
+
url: "https://newsteam.io/this-was-petes-idea",
|
|
86
|
+
},
|
|
87
|
+
fixable: "code",
|
|
88
|
+
messages: {
|
|
89
|
+
sortDependencies: "React hook dependencies should be sorted alphabetically.",
|
|
90
|
+
},
|
|
91
|
+
schema: [],
|
|
92
|
+
type: "suggestion",
|
|
93
|
+
},
|
|
19
94
|
},
|
|
20
95
|
},
|
|
21
|
-
|
|
96
|
+
};
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- im pretty sure it's safe
|
|
98
|
+
export default plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-function.d.ts","sourceRoot":"","sources":["../../src/rules/array-function.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAwD1C,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import arrayFunc from "eslint-plugin-array-func";
|
|
2
|
+
/*
|
|
3
|
+
* Rules for Array functions and methods.
|
|
4
|
+
*
|
|
5
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func
|
|
6
|
+
*/
|
|
7
|
+
export const arrayFuncPluginConfig = {
|
|
8
|
+
plugins: {
|
|
9
|
+
"array-func": arrayFunc,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
/*
|
|
13
|
+
* Avoid reversing the array and running a method on it if there is an
|
|
14
|
+
* equivalent of the method operating on the array from the other end.
|
|
15
|
+
*
|
|
16
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func#avoid-reverse
|
|
17
|
+
*/
|
|
18
|
+
"array-func/avoid-reverse": "warn",
|
|
19
|
+
/*
|
|
20
|
+
* Prefer using the mapFn callback of Array.from over an immediate
|
|
21
|
+
* .map() call on the Array.from result.
|
|
22
|
+
*
|
|
23
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func#from-map
|
|
24
|
+
*/
|
|
25
|
+
"array-func/from-map": "warn",
|
|
26
|
+
/*
|
|
27
|
+
* Avoid the this parameter when providing arrow function as callback
|
|
28
|
+
* in array functions.
|
|
29
|
+
*
|
|
30
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func#no-unnecessary-this-arg
|
|
31
|
+
*/
|
|
32
|
+
"array-func/no-unnecessary-this-arg": "warn",
|
|
33
|
+
/*
|
|
34
|
+
* Use Array.from instead of [...iterable] for performance benefits.
|
|
35
|
+
*
|
|
36
|
+
* Off for now, performance benefits probably don't warrant the irritation
|
|
37
|
+
*
|
|
38
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func#prefer-array-from
|
|
39
|
+
*/
|
|
40
|
+
"array-func/prefer-array-from": "off",
|
|
41
|
+
/*
|
|
42
|
+
* Use .flat() to flatten an array of arrays. This rule currently
|
|
43
|
+
* recognizes two patterns and can replace them with a .flat() call.
|
|
44
|
+
*
|
|
45
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func#prefer-flat
|
|
46
|
+
*/
|
|
47
|
+
"array-func/prefer-flat": "warn",
|
|
48
|
+
/*
|
|
49
|
+
* Use .flatMap() to flatten an array and map the values instead of
|
|
50
|
+
* using .flat().map().
|
|
51
|
+
*
|
|
52
|
+
* https://www.npmjs.com/package/eslint-plugin-array-func#prefer-flat-map
|
|
53
|
+
*/
|
|
54
|
+
"array-func/prefer-flat-map": "warn",
|
|
55
|
+
},
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css-modules.d.ts","sourceRoot":"","sources":["../../src/rules/css-modules.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUrC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAqB3C,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import cssModules from "@bhollis/eslint-plugin-css-modules";
|
|
2
|
+
/*
|
|
3
|
+
* This plugin intends to help you in tracking down problems when you are using css-modules.
|
|
4
|
+
* It tells if you are using a non-existent css/scss/less class in js or if you forgot to
|
|
5
|
+
* use some classes which you declared in css/scss/less.
|
|
6
|
+
*
|
|
7
|
+
* https://www.npmjs.com/package/eslint-plugin-css-modules
|
|
8
|
+
*/
|
|
9
|
+
export const cssModulesPluginConfig = {
|
|
10
|
+
plugins: {
|
|
11
|
+
"css-modules": cssModules,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
/*
|
|
15
|
+
* Broken in eslint 10
|
|
16
|
+
*
|
|
17
|
+
* https://www.npmjs.com/package/eslint-plugin-css-modules
|
|
18
|
+
*/
|
|
19
|
+
"css-modules/no-undef-class": ["off"],
|
|
20
|
+
/*
|
|
21
|
+
* Broken in eslint 10
|
|
22
|
+
*
|
|
23
|
+
* https://www.npmjs.com/package/eslint-plugin-css-modules
|
|
24
|
+
*/
|
|
25
|
+
"css-modules/no-unused-class": ["off"],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destructuring.d.ts","sourceRoot":"","sources":["../../src/rules/destructuring.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAwC9C,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import destructuring from "eslint-plugin-destructuring";
|
|
2
|
+
/*
|
|
3
|
+
* Destructuring-specific linting rules for ESLint.
|
|
4
|
+
*
|
|
5
|
+
* https://www.npmjs.com/package/eslint-plugin-destructuring
|
|
6
|
+
*/
|
|
7
|
+
export const destructuringPluginConfig = {
|
|
8
|
+
plugins: {
|
|
9
|
+
destructuring,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
/*
|
|
13
|
+
* Destructuring within params of a method can be messy, unreadable and moreover you loose an
|
|
14
|
+
* opportunity of giving a name to the param. This rule allows you to ban destructuring of
|
|
15
|
+
* params in method declarations.
|
|
16
|
+
*
|
|
17
|
+
* https://github.com/lukeapage/eslint-plugin-destructuring/blob/HEAD/docs/rules/in-methods-params.md
|
|
18
|
+
*/
|
|
19
|
+
"destructuring/in-methods-params": "warn",
|
|
20
|
+
/*
|
|
21
|
+
* Destructuring within params can be messy, particularly if you have more than one parameter.
|
|
22
|
+
* This rule allows you to configure the maximum parameters allowed when one or more is destructuring.
|
|
23
|
+
*
|
|
24
|
+
* https://github.com/lukeapage/eslint-plugin-destructuring/blob/HEAD/docs/rules/in-params.md
|
|
25
|
+
*/
|
|
26
|
+
"destructuring/in-params": ["warn", { "max-params": 0 }],
|
|
27
|
+
/*
|
|
28
|
+
* When destructuring an object, you can provide the variable name in order to have
|
|
29
|
+
* the variable name differ from the object property. This can produce confusing code
|
|
30
|
+
* that is harder to read than ES5 code, therefore this rule prevents it unless the
|
|
31
|
+
* object property is an invalid identifier (ie. a string literal).
|
|
32
|
+
*
|
|
33
|
+
* Off because we like renaming when destructuring
|
|
34
|
+
*
|
|
35
|
+
* https://github.com/lukeapage/eslint-plugin-destructuring/blob/HEAD/docs/rules/no-rename.md
|
|
36
|
+
*/
|
|
37
|
+
"destructuring/no-rename": "off",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-comments.d.ts","sourceRoot":"","sources":["../../src/rules/eslint-comments.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASrC,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MA+E/C,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import eslintComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
2
|
+
/*
|
|
3
|
+
* Additional ESLint rules for ESLint directive comments
|
|
4
|
+
* (e.g. //eslint-disable-line).
|
|
5
|
+
*
|
|
6
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/
|
|
7
|
+
*/
|
|
8
|
+
export const eslintCommentsPluginConfig = {
|
|
9
|
+
plugins: {
|
|
10
|
+
"eslint-comments": eslintComments,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
/*
|
|
14
|
+
* Require a eslint-enable comment for every eslint-disable comment
|
|
15
|
+
*
|
|
16
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
|
|
17
|
+
*/
|
|
18
|
+
"eslint-comments/disable-enable-pair": "warn",
|
|
19
|
+
/*
|
|
20
|
+
* Disallow a eslint-enable comment for multiple eslint-disable comments
|
|
21
|
+
*
|
|
22
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html
|
|
23
|
+
*/
|
|
24
|
+
"eslint-comments/no-aggregating-enable": "warn",
|
|
25
|
+
/*
|
|
26
|
+
* Disallow duplicate eslint-disable comments
|
|
27
|
+
*
|
|
28
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable.html
|
|
29
|
+
*/
|
|
30
|
+
"eslint-comments/no-duplicate-disable": "warn",
|
|
31
|
+
/*
|
|
32
|
+
* Disallow eslint-disable comments without rule names
|
|
33
|
+
*
|
|
34
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html
|
|
35
|
+
*/
|
|
36
|
+
"eslint-comments/no-restricted-disable": "warn",
|
|
37
|
+
/*
|
|
38
|
+
* Disallow eslint-disable comments about specific rules
|
|
39
|
+
*
|
|
40
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html
|
|
41
|
+
*/
|
|
42
|
+
"eslint-comments/no-unlimited-disable": "warn",
|
|
43
|
+
/*
|
|
44
|
+
* Disallow unused eslint-disable comments
|
|
45
|
+
*
|
|
46
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html
|
|
47
|
+
*/
|
|
48
|
+
"eslint-comments/no-unused-disable": "warn",
|
|
49
|
+
/*
|
|
50
|
+
* Disallow unused eslint-enable comments
|
|
51
|
+
*
|
|
52
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html
|
|
53
|
+
*/
|
|
54
|
+
"eslint-comments/no-unused-enable": "warn",
|
|
55
|
+
/*
|
|
56
|
+
* Disallow ESLint directive-comments
|
|
57
|
+
*
|
|
58
|
+
* Off for now because sometimes we have a good reason to use these
|
|
59
|
+
*
|
|
60
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-use.html
|
|
61
|
+
*/
|
|
62
|
+
"eslint-comments/no-use": "off",
|
|
63
|
+
/*
|
|
64
|
+
* This rule warns directive comments without description.
|
|
65
|
+
*
|
|
66
|
+
* https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html
|
|
67
|
+
*/
|
|
68
|
+
"eslint-comments/require-description": [
|
|
69
|
+
"warn",
|
|
70
|
+
{
|
|
71
|
+
ignore: [
|
|
72
|
+
"eslint-enable",
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-newlines.d.ts","sourceRoot":"","sources":["../../src/rules/import-newlines.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQrC,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAqB/C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import importNewlines from "eslint-plugin-import-newlines";
|
|
2
|
+
/*
|
|
3
|
+
* ESLint plugin for enforcing newlines in ES6 import statements past a certain number of items.
|
|
4
|
+
*
|
|
5
|
+
* https://www.npmjs.com/package/eslint-plugin-import-newlines
|
|
6
|
+
*/
|
|
7
|
+
export const importNewlinesPluginConfig = {
|
|
8
|
+
plugins: {
|
|
9
|
+
"import-newlines": importNewlines,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
/*
|
|
13
|
+
* ESLint plugin for enforcing newlines in ES6 import statements past a certain number of items.
|
|
14
|
+
*
|
|
15
|
+
* https://www.npmjs.com/package/eslint-plugin-import-newlines
|
|
16
|
+
*/
|
|
17
|
+
"import-newlines/enforce": [
|
|
18
|
+
"warn",
|
|
19
|
+
{
|
|
20
|
+
items: 1,
|
|
21
|
+
"max-len": Number.POSITIVE_INFINITY,
|
|
22
|
+
semi: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-x.d.ts","sourceRoot":"","sources":["../../src/rules/import-x.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAER,MAAM,EACT,MAAM,QAAQ,CAAC;AAGhB,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MA6fxC,CAAC"}
|