@paratco/eslint-config 0.7.0 → 0.7.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 +2 -1
- package/src/configs/import.js +25 -25
- package/src/configs/node.js +11 -11
- package/src/configs/react.js +60 -60
- package/src/lints/import/index.js +13 -1
- package/src/lints/stylistic/index.js +529 -525
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paratco/eslint-config",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Paratco",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"@stylistic/eslint-plugin": "^2.3.0",
|
|
30
30
|
"@types/eslint__js": "^8.42.3",
|
|
31
31
|
"eslint-config-prettier": "^9.1.0",
|
|
32
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
32
33
|
"eslint-plugin-import": "^2.29.1",
|
|
33
34
|
"eslint-plugin-react": "^7.34.3",
|
|
34
35
|
"eslint-plugin-react-hooks": "^4.6.2",
|
package/src/configs/import.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import eslintPluginImport from "eslint-plugin-import";
|
|
2
|
-
|
|
3
|
-
// Custom Rules
|
|
4
|
-
import importRules 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: eslintPluginImport
|
|
12
|
-
},
|
|
13
|
-
settings: {
|
|
14
|
-
"import/resolver": {
|
|
15
|
-
typescript: {
|
|
16
|
-
alwaysTryTypes: true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
rules: {
|
|
21
|
-
...eslintPluginImport.configs.recommended.rules,
|
|
22
|
-
...importRules
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
];
|
|
1
|
+
import eslintPluginImport from "eslint-plugin-import";
|
|
2
|
+
|
|
3
|
+
// Custom Rules
|
|
4
|
+
import importRules 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: eslintPluginImport
|
|
12
|
+
},
|
|
13
|
+
settings: {
|
|
14
|
+
"import/resolver": {
|
|
15
|
+
typescript: {
|
|
16
|
+
alwaysTryTypes: true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...eslintPluginImport.configs.recommended.rules,
|
|
22
|
+
...importRules
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
];
|
package/src/configs/node.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import globals from "globals";
|
|
2
|
-
import baseConfig from "./base.js";
|
|
3
|
-
import importConfig from "./import.js";
|
|
4
|
-
|
|
5
|
-
export default [
|
|
6
|
-
...baseConfig,
|
|
7
|
-
...importConfig,
|
|
8
|
-
|
|
9
|
-
// Node Only
|
|
10
|
-
{ languageOptions: { globals: globals.node } }
|
|
11
|
-
];
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import baseConfig from "./base.js";
|
|
3
|
+
import importConfig from "./import.js";
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
...baseConfig,
|
|
7
|
+
...importConfig,
|
|
8
|
+
|
|
9
|
+
// Node Only
|
|
10
|
+
{ languageOptions: { globals: globals.node } }
|
|
11
|
+
];
|
package/src/configs/react.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import globals from "globals";
|
|
2
|
-
import baseConfig from "./base.js";
|
|
3
|
-
import importConfig from "./import.js";
|
|
4
|
-
|
|
5
|
-
// Plugins
|
|
6
|
-
import react from "eslint-plugin-react";
|
|
7
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
|
8
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
|
9
|
-
|
|
10
|
-
// Custom Rules
|
|
11
|
-
import reactRules from "../lints/react/index.js";
|
|
12
|
-
|
|
13
|
-
export default [
|
|
14
|
-
...baseConfig,
|
|
15
|
-
...importConfig,
|
|
16
|
-
|
|
17
|
-
// Browser Only
|
|
18
|
-
{ languageOptions: { globals: globals.browser } },
|
|
19
|
-
|
|
20
|
-
// Enable JSX
|
|
21
|
-
{ files: ["**/*.tsx"], languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
22
|
-
|
|
23
|
-
// React Plugin
|
|
24
|
-
{
|
|
25
|
-
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
26
|
-
plugins: {
|
|
27
|
-
react: react,
|
|
28
|
-
"react-hooks": reactHooks,
|
|
29
|
-
"react-refresh": reactRefresh
|
|
30
|
-
},
|
|
31
|
-
settings: {
|
|
32
|
-
react: {
|
|
33
|
-
version: "detect"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
languageOptions: {
|
|
37
|
-
parserOptions: {
|
|
38
|
-
ecmaFeatures: {
|
|
39
|
-
jsx: true
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
globals: {
|
|
43
|
-
...globals.browser
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
rules: {
|
|
47
|
-
...reactRules,
|
|
48
|
-
// ...react.configs.recommended.rules,
|
|
49
|
-
...reactHooks.configs.recommended.rules,
|
|
50
|
-
|
|
51
|
-
// Enforce Rules of Hooks
|
|
52
|
-
"react-hooks/rules-of-hooks": ["error"],
|
|
53
|
-
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
54
|
-
"react-hooks/exhaustive-deps": ["error"],
|
|
55
|
-
|
|
56
|
-
// React Refresh
|
|
57
|
-
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
];
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import baseConfig from "./base.js";
|
|
3
|
+
import importConfig from "./import.js";
|
|
4
|
+
|
|
5
|
+
// Plugins
|
|
6
|
+
import react from "eslint-plugin-react";
|
|
7
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
8
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
9
|
+
|
|
10
|
+
// Custom Rules
|
|
11
|
+
import reactRules from "../lints/react/index.js";
|
|
12
|
+
|
|
13
|
+
export default [
|
|
14
|
+
...baseConfig,
|
|
15
|
+
...importConfig,
|
|
16
|
+
|
|
17
|
+
// Browser Only
|
|
18
|
+
{ languageOptions: { globals: globals.browser } },
|
|
19
|
+
|
|
20
|
+
// Enable JSX
|
|
21
|
+
{ files: ["**/*.tsx"], languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
22
|
+
|
|
23
|
+
// React Plugin
|
|
24
|
+
{
|
|
25
|
+
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
26
|
+
plugins: {
|
|
27
|
+
react: react,
|
|
28
|
+
"react-hooks": reactHooks,
|
|
29
|
+
"react-refresh": reactRefresh
|
|
30
|
+
},
|
|
31
|
+
settings: {
|
|
32
|
+
react: {
|
|
33
|
+
version: "detect"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
languageOptions: {
|
|
37
|
+
parserOptions: {
|
|
38
|
+
ecmaFeatures: {
|
|
39
|
+
jsx: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
globals: {
|
|
43
|
+
...globals.browser
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
...reactRules,
|
|
48
|
+
// ...react.configs.recommended.rules,
|
|
49
|
+
...reactHooks.configs.recommended.rules,
|
|
50
|
+
|
|
51
|
+
// Enforce Rules of Hooks
|
|
52
|
+
"react-hooks/rules-of-hooks": ["error"],
|
|
53
|
+
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
54
|
+
"react-hooks/exhaustive-deps": ["error"],
|
|
55
|
+
|
|
56
|
+
// React Refresh
|
|
57
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
];
|
|
@@ -127,7 +127,19 @@ export default {
|
|
|
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/no-anonymous-default-export": [
|
|
131
|
+
"error",
|
|
132
|
+
{
|
|
133
|
+
allowArray: false,
|
|
134
|
+
allowArrowFunction: true,
|
|
135
|
+
allowAnonymousClass: false,
|
|
136
|
+
allowAnonymousFunction: false,
|
|
137
|
+
allowCallExpression: true, // The true value here is for backward compatibility
|
|
138
|
+
allowNew: false,
|
|
139
|
+
allowLiteral: false,
|
|
140
|
+
allowObject: false
|
|
141
|
+
}
|
|
142
|
+
],
|
|
131
143
|
|
|
132
144
|
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
|
|
133
145
|
// Forbid default exports.
|