@pob/eslint-config 56.1.0 → 57.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 +8 -80
- package/lib/_base.js +39 -17
- package/lib/base/commonjs.js +9 -4
- package/lib/base/module.js +23 -4
- package/lib/index.js +67 -13
- package/lib/node/_base.js +10 -18
- package/lib/node/commonjs.js +14 -23
- package/lib/node/module.js +22 -30
- package/lib/plugins/import/import-base.js +105 -72
- package/lib/plugins/import/import-commonjs.js +2 -3
- package/lib/plugins/import/import-module.js +2 -3
- package/lib/plugins/unicorn.js +239 -239
- package/lib/rules/best-practices.js +12 -5
- package/lib/rules/code-quality.js +2 -3
- package/lib/rules/dev-only.js +4 -3
- package/lib/rules/errors.js +2 -3
- package/lib/rules/style.js +2 -3
- package/package.json +9 -9
- package/utils.js +1 -3
- package/lib/.eslintrc.json +0 -4
- package/lib/node-commonjs.js +0 -25
- package/lib/node-module.js +0 -25
- package/lib/root-commonjs.js +0 -6
- package/lib/root-module.js +0 -6
- package/lib/rules/modules/base.js +0 -8
- package/lib/rules/modules/commonjs.js +0 -11
- package/lib/rules/modules/esm.js +0 -25
|
@@ -1,99 +1,132 @@
|
|
|
1
|
-
|
|
1
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
plugins
|
|
3
|
+
function legacyPlugin(compat, name, alias = name) {
|
|
4
|
+
const plugin = compat.plugins(name)[0]?.plugins?.[alias];
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
if (!plugin) {
|
|
7
|
+
throw new Error(`Unable to resolve plugin ${name} and/or alias ${alias}`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return fixupPluginRules(plugin);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default (compat) => [
|
|
14
|
+
{
|
|
15
|
+
//
|
|
16
|
+
languageOptions: {
|
|
17
|
+
parserOptions: {
|
|
18
|
+
ecmaVersion: 2022,
|
|
19
|
+
sourceType: "module",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
plugins: {
|
|
23
|
+
import: legacyPlugin(compat, "eslint-plugin-import", "import"),
|
|
24
|
+
},
|
|
25
|
+
settings: {
|
|
26
|
+
"import/parsers": {
|
|
27
|
+
// https://github.com/import-js/eslint-plugin-import/issues/2556#issuecomment-1419518561
|
|
28
|
+
espree: [".js", ".cjs", ".mjs"],
|
|
29
|
+
},
|
|
30
|
+
"import/resolver": {
|
|
31
|
+
node: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
10
34
|
},
|
|
35
|
+
...compat.config({
|
|
36
|
+
settings: {
|
|
37
|
+
"import/extensions": [".js", ".mjs"],
|
|
38
|
+
"import/ignore": ["node_modules"],
|
|
39
|
+
},
|
|
11
40
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
41
|
+
rules: {
|
|
42
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
|
|
43
|
+
"import/no-unresolved": [
|
|
44
|
+
"error",
|
|
45
|
+
{ commonjs: true, caseSensitive: true },
|
|
46
|
+
],
|
|
15
47
|
|
|
16
|
-
|
|
17
|
-
|
|
48
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md
|
|
49
|
+
"import/named": "error",
|
|
18
50
|
|
|
19
|
-
|
|
20
|
-
|
|
51
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md
|
|
52
|
+
"import/export": "error",
|
|
21
53
|
|
|
22
|
-
|
|
23
|
-
|
|
54
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
|
|
55
|
+
"import/no-named-as-default": "error",
|
|
24
56
|
|
|
25
|
-
|
|
26
|
-
|
|
57
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
|
|
58
|
+
"import/no-named-as-default-member": "error",
|
|
27
59
|
|
|
28
|
-
|
|
29
|
-
|
|
60
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
|
|
61
|
+
"import/no-deprecated": "off",
|
|
30
62
|
|
|
31
|
-
|
|
32
|
-
|
|
63
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
|
|
64
|
+
"import/no-extraneous-dependencies": "error",
|
|
33
65
|
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
|
|
67
|
+
"import/no-mutable-exports": "error",
|
|
36
68
|
|
|
37
|
-
|
|
38
|
-
|
|
69
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
|
|
70
|
+
"import/no-amd": "error",
|
|
39
71
|
|
|
40
|
-
|
|
41
|
-
|
|
72
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
|
|
73
|
+
"import/first": "error",
|
|
42
74
|
|
|
43
|
-
|
|
44
|
-
|
|
75
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
76
|
+
"import/no-duplicates": "error",
|
|
45
77
|
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
|
|
79
|
+
"import/newline-after-import": "error",
|
|
48
80
|
|
|
49
|
-
|
|
50
|
-
|
|
81
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
|
|
82
|
+
"import/prefer-default-export": "off",
|
|
51
83
|
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
|
|
85
|
+
"import/no-absolute-path": "error",
|
|
54
86
|
|
|
55
|
-
|
|
56
|
-
|
|
87
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
|
|
88
|
+
"import/no-dynamic-require": "error",
|
|
57
89
|
|
|
58
|
-
|
|
59
|
-
|
|
90
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
|
|
91
|
+
"import/no-webpack-loader-syntax": "error",
|
|
60
92
|
|
|
61
|
-
|
|
62
|
-
|
|
93
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
|
|
94
|
+
"import/no-named-default": "error",
|
|
63
95
|
|
|
64
|
-
|
|
65
|
-
|
|
96
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-self-import.md
|
|
97
|
+
"import/no-self-import": "error",
|
|
66
98
|
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-cycle.md
|
|
100
|
+
"import/no-cycle": ["error", { maxDepth: "∞" }],
|
|
69
101
|
|
|
70
|
-
|
|
71
|
-
|
|
102
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-useless-path-segments.md
|
|
103
|
+
"import/no-useless-path-segments": ["error", { commonjs: true }],
|
|
72
104
|
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-import-module-exports.md
|
|
106
|
+
"import/no-import-module-exports": "error",
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
|
|
108
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-relative-packages.md
|
|
109
|
+
"import/no-relative-packages": "error",
|
|
78
110
|
|
|
79
|
-
|
|
80
|
-
|
|
111
|
+
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-empty-named-blocks.md
|
|
112
|
+
"import/no-empty-named-blocks": "error",
|
|
81
113
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
114
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
|
|
115
|
+
"import/order": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
groups: [
|
|
119
|
+
"builtin",
|
|
120
|
+
"external",
|
|
121
|
+
"internal",
|
|
122
|
+
"parent",
|
|
123
|
+
"sibling",
|
|
124
|
+
"index",
|
|
125
|
+
],
|
|
126
|
+
alphabetize: { order: "asc", caseInsensitive: false },
|
|
127
|
+
"newlines-between": "never",
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
];
|