@paratco/eslint-config 0.8.0 → 0.8.2
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/package.json +6 -7
- package/src/configs/base.js +25 -18
- package/src/configs/import.js +25 -25
- package/src/lints/import/index.js +36 -36
- package/src/lints/javascript/index.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paratco/eslint-config",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Paratco",
|
|
@@ -27,18 +27,17 @@
|
|
|
27
27
|
"prettier": "^3.3.3"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"eslint": "^9.9.0",
|
|
31
|
-
"typescript-eslint": "^8.1.0",
|
|
32
|
-
"prettier": "^3.3.3",
|
|
33
30
|
"@eslint/js": "^9.9.0",
|
|
34
31
|
"@stylistic/eslint-plugin": "^2.6.4",
|
|
35
32
|
"@types/eslint__js": "^8.42.3",
|
|
33
|
+
"eslint": "^9.9.0",
|
|
36
34
|
"eslint-config-prettier": "^9.1.0",
|
|
37
35
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
38
|
-
"eslint-plugin-import": "^
|
|
36
|
+
"eslint-plugin-import-x": "^3.1.0",
|
|
39
37
|
"eslint-plugin-react": "^7.35.0",
|
|
40
|
-
"eslint-plugin-react-hooks": "^
|
|
38
|
+
"eslint-plugin-react-hooks": "^5.1.0-rc-1eaccd82-20240816",
|
|
41
39
|
"eslint-plugin-react-refresh": "^0.4.9",
|
|
42
|
-
"globals": "^15.9.0"
|
|
40
|
+
"globals": "^15.9.0",
|
|
41
|
+
"typescript-eslint": "^8.1.0"
|
|
43
42
|
}
|
|
44
43
|
}
|
package/src/configs/base.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import eslint from "@eslint/js";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
// Custom Rules
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import tsEslint from "typescript-eslint";
|
|
3
|
+
|
|
4
|
+
// Custom Rules
|
|
5
|
+
import javascriptRules from "../lints/javascript/index.js";
|
|
6
|
+
import typescriptRules from "../lints/typescript/index.js";
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
// Set predefined configs
|
|
10
|
+
eslint.configs.recommended,
|
|
11
|
+
...tsEslint.configs.strictTypeChecked,
|
|
12
|
+
...tsEslint.configs.stylisticTypeChecked,
|
|
13
|
+
|
|
14
|
+
// JavaScript Rules
|
|
15
|
+
{
|
|
16
|
+
files: ["**/*.{js,jsx,mjs,cjs}"],
|
|
17
|
+
rules: javascriptRules
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
// TypeScript Rules
|
|
21
|
+
{
|
|
22
|
+
files: ["**/*.{ts,tsx}"],
|
|
23
|
+
rules: typescriptRules
|
|
24
|
+
}
|
|
25
|
+
];
|
package/src/configs/import.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
// Custom Rules
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
// ESLint Plugin Import
|
|
8
|
-
{
|
|
9
|
-
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
10
|
-
plugins: {
|
|
11
|
-
import:
|
|
12
|
-
},
|
|
13
|
-
settings: {
|
|
14
|
-
"import/resolver": {
|
|
15
|
-
typescript: {
|
|
16
|
-
alwaysTryTypes: true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
rules: {
|
|
21
|
-
...
|
|
22
|
-
...
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
];
|
|
1
|
+
import eslintPluginImportX from "eslint-plugin-import-x";
|
|
2
|
+
|
|
3
|
+
// Custom Rules
|
|
4
|
+
import importXRules from "../lints/import/index.js";
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
// ESLint Plugin Import
|
|
8
|
+
{
|
|
9
|
+
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
10
|
+
plugins: {
|
|
11
|
+
"import-x": eslintPluginImportX
|
|
12
|
+
},
|
|
13
|
+
settings: {
|
|
14
|
+
"import-x/resolver": {
|
|
15
|
+
typescript: {
|
|
16
|
+
alwaysTryTypes: true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...eslintPluginImportX.configs.recommended.rules,
|
|
22
|
+
...importXRules
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
];
|
|
@@ -1,86 +1,86 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
|
|
3
3
|
// Forbid imported names marked with @deprecated documentation tag.
|
|
4
|
-
"import/no-deprecated": ["error"],
|
|
4
|
+
"import-x/no-deprecated": ["error"],
|
|
5
5
|
|
|
6
6
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-empty-named-blocks.md
|
|
7
7
|
// Forbid empty named import blocks.
|
|
8
|
-
"import/no-empty-named-blocks": ["warn"],
|
|
8
|
+
"import-x/no-empty-named-blocks": ["warn"],
|
|
9
9
|
|
|
10
10
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
|
|
11
11
|
// Forbid the use of extraneous packages.
|
|
12
|
-
"import/no-extraneous-dependencies": [
|
|
12
|
+
"import-x/no-extraneous-dependencies": [
|
|
13
13
|
"error",
|
|
14
14
|
{ devDependencies: false, optionalDependencies: false, peerDependencies: false }
|
|
15
15
|
],
|
|
16
16
|
|
|
17
17
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
|
|
18
18
|
// Forbid the use of mutable exports with var or let.
|
|
19
|
-
"import/no-mutable-exports": ["error"],
|
|
19
|
+
"import-x/no-mutable-exports": ["error"],
|
|
20
20
|
|
|
21
21
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md
|
|
22
22
|
// Forbid modules without exports, or exports without matching import in another module.
|
|
23
23
|
// TODO: Can be enabled
|
|
24
|
-
"import/no-unused-modules": ["off", { missingExports: true }],
|
|
24
|
+
"import-x/no-unused-modules": ["off", { missingExports: true }],
|
|
25
25
|
|
|
26
26
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-amd.md
|
|
27
27
|
// Forbid AMD require and define calls.
|
|
28
|
-
"import/no-amd": ["error"],
|
|
28
|
+
"import-x/no-amd": ["error"],
|
|
29
29
|
|
|
30
30
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-commonjs.md
|
|
31
31
|
// Forbid CommonJS require calls and module.exports or exports.*.
|
|
32
|
-
"import/no-commonjs": ["error"],
|
|
32
|
+
"import-x/no-commonjs": ["error"],
|
|
33
33
|
|
|
34
34
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-import-module-exports.md
|
|
35
35
|
// Forbid import statements with CommonJS module.exports.
|
|
36
|
-
"import/no-import-module-exports": ["warn"],
|
|
36
|
+
"import-x/no-import-module-exports": ["warn"],
|
|
37
37
|
|
|
38
38
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-nodejs-modules.md
|
|
39
39
|
// Forbid Node.js builtin modules.
|
|
40
40
|
// TODO: Can enable for front-end
|
|
41
|
-
"import/no-nodejs-modules": ["off"],
|
|
41
|
+
"import-x/no-nodejs-modules": ["off"],
|
|
42
42
|
|
|
43
43
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/unambiguous.md
|
|
44
44
|
// Forbid potentially ambiguous parse goal (script vs. module).
|
|
45
|
-
"import/unambiguous": ["error"],
|
|
45
|
+
"import-x/unambiguous": ["error"],
|
|
46
46
|
|
|
47
47
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
|
|
48
48
|
// Forbid import of modules using absolute paths.
|
|
49
|
-
"import/no-absolute-path": ["warn"],
|
|
49
|
+
"import-x/no-absolute-path": ["warn"],
|
|
50
50
|
|
|
51
51
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
|
|
52
52
|
// Forbid a module from importing a module with a dependency path back to itself.
|
|
53
|
-
"import/no-cycle": ["error"],
|
|
53
|
+
"import-x/no-cycle": ["error"],
|
|
54
54
|
|
|
55
55
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-dynamic-require.md
|
|
56
56
|
// Forbid require() calls with expressions.
|
|
57
|
-
"import/no-dynamic-require": ["off"],
|
|
57
|
+
"import-x/no-dynamic-require": ["off"],
|
|
58
58
|
|
|
59
59
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-internal-modules.md
|
|
60
60
|
// Forbid importing the submodules of other modules.
|
|
61
61
|
// TODO: Must define in the project
|
|
62
|
-
"import/no-internal-modules": ["off"],
|
|
62
|
+
"import-x/no-internal-modules": ["off"],
|
|
63
63
|
|
|
64
64
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
|
|
65
65
|
// Forbid importing packages through relative paths.
|
|
66
|
-
"import/no-relative-packages": ["warn"],
|
|
66
|
+
"import-x/no-relative-packages": ["warn"],
|
|
67
67
|
|
|
68
68
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-parent-imports.md
|
|
69
69
|
// Forbid importing modules from parent directories.
|
|
70
|
-
"import/no-relative-parent-imports": ["off"],
|
|
70
|
+
"import-x/no-relative-parent-imports": ["off"],
|
|
71
71
|
|
|
72
72
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-restricted-paths.md
|
|
73
73
|
// Enforce which files can be imported in a given folder.
|
|
74
74
|
// TODO: Can be customized
|
|
75
|
-
// "import/no-restricted-paths": ["off"],
|
|
75
|
+
// "import-x/no-restricted-paths": ["off"],
|
|
76
76
|
|
|
77
77
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
|
|
78
78
|
// Forbid a module from importing itself.
|
|
79
|
-
"import/no-self-import": ["error"],
|
|
79
|
+
"import-x/no-self-import": ["error"],
|
|
80
80
|
|
|
81
81
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
|
|
82
82
|
// Forbid unnecessary path segments in import and require statements.
|
|
83
|
-
"import/no-useless-path-segments": [
|
|
83
|
+
"import-x/no-useless-path-segments": [
|
|
84
84
|
"warn",
|
|
85
85
|
{
|
|
86
86
|
noUselessIndex: true
|
|
@@ -89,45 +89,45 @@ export default {
|
|
|
89
89
|
|
|
90
90
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-webpack-loader-syntax.md
|
|
91
91
|
// Forbid webpack loader syntax in imports.
|
|
92
|
-
"import/no-webpack-loader-syntax": ["error"],
|
|
92
|
+
"import-x/no-webpack-loader-syntax": ["error"],
|
|
93
93
|
|
|
94
94
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md
|
|
95
95
|
// Enforce or ban the use of inline type-only markers for named imports.
|
|
96
|
-
"import/consistent-type-specifier-style": ["warn", "prefer-top-level"],
|
|
96
|
+
"import-x/consistent-type-specifier-style": ["warn", "prefer-top-level"],
|
|
97
97
|
|
|
98
98
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/dynamic-import-chunkname.md
|
|
99
99
|
// Enforce a leading comment with the webpackChunkName for dynamic imports.
|
|
100
|
-
"import/dynamic-import-chunkname": ["off"],
|
|
100
|
+
"import-x/dynamic-import-chunkname": ["off"],
|
|
101
101
|
|
|
102
102
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
|
|
103
103
|
// Ensure all exports appear after other statements.
|
|
104
104
|
// TODO: Can be enabled
|
|
105
|
-
"import/exports-last": ["off"],
|
|
105
|
+
"import-x/exports-last": ["off"],
|
|
106
106
|
|
|
107
107
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md
|
|
108
108
|
// Ensure consistent use of file extension within the import path.
|
|
109
|
-
"import/extensions": ["error", "never"],
|
|
109
|
+
"import-x/extensions": ["error", "never"],
|
|
110
110
|
|
|
111
111
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
|
|
112
112
|
// Ensure all imports appear before other statements.
|
|
113
|
-
"import/first": ["warn"],
|
|
113
|
+
"import-x/first": ["warn"],
|
|
114
114
|
|
|
115
115
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/group-exports.md
|
|
116
116
|
// Prefer named exports to be grouped together in a single export declaration
|
|
117
117
|
// TODO: Can be enabled
|
|
118
|
-
"import/group-exports": ["off"],
|
|
118
|
+
"import-x/group-exports": ["off"],
|
|
119
119
|
|
|
120
120
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/max-dependencies.md
|
|
121
121
|
// Enforce the maximum number of dependencies a module can have.
|
|
122
|
-
"import/max-dependencies": ["off"],
|
|
122
|
+
"import-x/max-dependencies": ["off"],
|
|
123
123
|
|
|
124
124
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
|
|
125
125
|
// Enforce a newline after import statements.
|
|
126
|
-
"import/newline-after-import": ["warn"],
|
|
126
|
+
"import-x/newline-after-import": ["warn"],
|
|
127
127
|
|
|
128
128
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-anonymous-default-export.md
|
|
129
129
|
// Forbid anonymous values as default exports.
|
|
130
|
-
"import/no-anonymous-default-export": [
|
|
130
|
+
"import-x/no-anonymous-default-export": [
|
|
131
131
|
"error",
|
|
132
132
|
{
|
|
133
133
|
allowArray: false,
|
|
@@ -143,29 +143,29 @@ export default {
|
|
|
143
143
|
|
|
144
144
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
145
145
|
// Forbid default exports.
|
|
146
|
-
"import/no-default-export": ["off"],
|
|
146
|
+
"import-x/no-default-export": ["off"],
|
|
147
147
|
|
|
148
148
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-default.md
|
|
149
149
|
// Forbid named default exports.
|
|
150
|
-
"import/no-named-default": ["off"],
|
|
150
|
+
"import-x/no-named-default": ["off"],
|
|
151
151
|
|
|
152
152
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-export.md
|
|
153
153
|
// Forbid named exports.
|
|
154
|
-
"import/no-named-export": ["off"],
|
|
154
|
+
"import-x/no-named-export": ["off"],
|
|
155
155
|
|
|
156
156
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-namespace.md
|
|
157
157
|
// Forbid namespace (a.k.a. "wildcard" *) imports.
|
|
158
|
-
"import/no-namespace": ["warn"],
|
|
158
|
+
"import-x/no-namespace": ["warn"],
|
|
159
159
|
|
|
160
160
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unassigned-import.md
|
|
161
161
|
// Forbid unassigned imports
|
|
162
|
-
"import/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
|
|
162
|
+
"import-x/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
|
|
163
163
|
|
|
164
164
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
|
|
165
165
|
// Enforce a convention in module import order.
|
|
166
|
-
"import/order": ["warn"],
|
|
166
|
+
"import-x/order": ["warn"],
|
|
167
167
|
|
|
168
168
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md
|
|
169
169
|
// Prefer a default export if module exports a single name or multiple names.
|
|
170
|
-
"import/prefer-default-export": ["off"]
|
|
170
|
+
"import-x/prefer-default-export": ["off"]
|
|
171
171
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
// https://eslint.org/docs/latest/rules/eqeqeq
|
|
3
|
+
// Require the use of === and !==
|
|
4
|
+
eqeqeq: ["warn"],
|
|
5
|
+
|
|
6
|
+
// https://eslint.org/docs/latest/rules/curly
|
|
7
|
+
// Enforce consistent brace style for all control statements
|
|
8
|
+
curly: ["warn", "all"]
|
|
9
|
+
};
|