eslint-config-mgz 1.0.9 → 1.0.12
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/flat-config.js +16 -33
- package/package.json +1 -1
package/flat-config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// eslint-config-mgz/flat-config.js
|
|
2
2
|
/**
|
|
3
|
-
* Universal ESLint config for
|
|
3
|
+
* Universal ESLint config for TypeScript + React projects
|
|
4
4
|
* Works with ESLint v7, v8 (FlatCompat) and ESLint v9+ (native flat config)
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ let config;
|
|
|
17
17
|
|
|
18
18
|
if (isEslintV9Plus()) {
|
|
19
19
|
// ESLint v9+ flat config
|
|
20
|
-
const
|
|
20
|
+
const js = require("@eslint/js");
|
|
21
21
|
const tseslint = require("typescript-eslint");
|
|
22
22
|
const reactPlugin = require("eslint-plugin-react");
|
|
23
23
|
const reactHooks = require("eslint-plugin-react-hooks");
|
|
@@ -35,18 +35,10 @@ if (isEslintV9Plus()) {
|
|
|
35
35
|
"eslint.config.*",
|
|
36
36
|
],
|
|
37
37
|
},
|
|
38
|
-
|
|
38
|
+
js.configs.recommended,
|
|
39
39
|
...tseslint.configs.recommended,
|
|
40
40
|
{
|
|
41
41
|
files: ["**/*.{ts,tsx,js,jsx}"],
|
|
42
|
-
languageOptions: {
|
|
43
|
-
parser: tseslint.parser,
|
|
44
|
-
parserOptions: {
|
|
45
|
-
project: "./tsconfig.json",
|
|
46
|
-
ecmaVersion: "latest",
|
|
47
|
-
sourceType: "module",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
42
|
plugins: {
|
|
51
43
|
"@typescript-eslint": tseslint.plugin,
|
|
52
44
|
react: reactPlugin,
|
|
@@ -54,8 +46,16 @@ if (isEslintV9Plus()) {
|
|
|
54
46
|
import: importPlugin,
|
|
55
47
|
"jsx-a11y": jsxA11y,
|
|
56
48
|
},
|
|
49
|
+
settings: {
|
|
50
|
+
react: { version: "detect" },
|
|
51
|
+
"import/resolver": {
|
|
52
|
+
node: {
|
|
53
|
+
paths: ["src"],
|
|
54
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
57
58
|
rules: {
|
|
58
|
-
// General rules
|
|
59
59
|
"no-alert": "error",
|
|
60
60
|
"no-console": "error",
|
|
61
61
|
"no-undef-init": "error",
|
|
@@ -63,37 +63,20 @@ if (isEslintV9Plus()) {
|
|
|
63
63
|
"no-var": "error",
|
|
64
64
|
"no-inline-comments": "off",
|
|
65
65
|
"no-use-before-define": "off",
|
|
66
|
-
"no-
|
|
67
|
-
|
|
68
|
-
// TypeScript
|
|
69
|
-
"@typescript-eslint/no-unused-vars": "warn",
|
|
70
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
71
|
-
"@typescript-eslint/prefer-const": "error",
|
|
72
|
-
|
|
73
|
-
// React
|
|
66
|
+
"import/no-unresolved": "off",
|
|
74
67
|
"react/react-in-jsx-scope": "off",
|
|
75
68
|
"react/display-name": "off",
|
|
76
|
-
"react/prop-types": "off",
|
|
77
69
|
"react/no-array-index-key": "warn",
|
|
78
|
-
|
|
79
|
-
// React Hooks
|
|
80
|
-
"react-hooks/rules-of-hooks": "error",
|
|
81
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
82
|
-
|
|
83
|
-
// Import plugin
|
|
84
|
-
"import/no-unresolved": "off",
|
|
85
|
-
"import/named": "off",
|
|
86
|
-
|
|
87
|
-
// JSX A11y
|
|
70
|
+
"no-duplicate-imports": "warn",
|
|
88
71
|
"jsx-a11y/no-autofocus": "off",
|
|
89
72
|
"jsx-a11y/anchor-has-content": "off",
|
|
90
73
|
"jsx-a11y/heading-has-content": "off",
|
|
91
|
-
|
|
92
|
-
// Custom unknown props
|
|
74
|
+
"react/prop-types": "off",
|
|
93
75
|
"react/no-unknown-property": [
|
|
94
76
|
"error",
|
|
95
77
|
{ ignore: ["cmdk-input-wrapper", "cmdk-empty"] },
|
|
96
78
|
],
|
|
79
|
+
"import/named": "off",
|
|
97
80
|
},
|
|
98
81
|
},
|
|
99
82
|
];
|