@keeex/eslint-config 2.2.3 → 2.2.5
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/README.md +1 -0
- package/package.json +6 -6
- package/src/config/react.js +9 -5
- package/src/config/reactfullconfig.js +10 -2
package/README.md
CHANGED
|
@@ -179,6 +179,7 @@ To improve handling of React/JSX, set `react` to true. You can also pass an obje
|
|
|
179
179
|
following boolean properties:
|
|
180
180
|
|
|
181
181
|
- `reactHooks`: enable/disable React hooks rules
|
|
182
|
+
- `newJsxRuntime`: enable/disable new JSX runtime rules
|
|
182
183
|
|
|
183
184
|
You can't enable the hooks rules without enabling React, so if an object is provided React support
|
|
184
185
|
is automatically enabled.
|
package/package.json
CHANGED
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@eslint/compat": "^1.2.4",
|
|
19
19
|
"@eslint/js": "^9.12.0",
|
|
20
|
-
"eslint": "^9.
|
|
20
|
+
"eslint": "^9.17.0",
|
|
21
21
|
"eslint-import-resolver-typescript": "^3.7.0",
|
|
22
22
|
"eslint-import-resolver-webpack": "^0.13.10",
|
|
23
|
-
"eslint-plugin-import-x": "^4.
|
|
23
|
+
"eslint-plugin-import-x": "^4.6.1",
|
|
24
24
|
"eslint-plugin-mocha": "^10.5.0",
|
|
25
25
|
"eslint-plugin-promise": "^7.2.1",
|
|
26
|
-
"eslint-plugin-react": "^7.37.
|
|
26
|
+
"eslint-plugin-react": "^7.37.3",
|
|
27
27
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
28
28
|
"eslint-plugin-tsdoc": "^0.4.0",
|
|
29
|
-
"globals": "^15.
|
|
29
|
+
"globals": "^15.14.0",
|
|
30
30
|
"prettier": "^3.4.2",
|
|
31
|
-
"typescript-eslint": "^8.
|
|
31
|
+
"typescript-eslint": "^8.19.0"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"prettier.config.js",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"test": "echo No test for this project"
|
|
113
113
|
},
|
|
114
114
|
"type": "module",
|
|
115
|
-
"version": "2.2.
|
|
115
|
+
"version": "2.2.5"
|
|
116
116
|
}
|
package/src/config/react.js
CHANGED
|
@@ -16,10 +16,14 @@ export const apply = (configResult, eslintConfig) => {
|
|
|
16
16
|
jsx: true,
|
|
17
17
|
typescript: Boolean(eslintConfig.typescript),
|
|
18
18
|
});
|
|
19
|
-
configResult.push(
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
19
|
+
configResult.push({...reactPlugin.configs.flat.recommended, files, name: "react/recommended"});
|
|
20
|
+
if (reactCfg.newJsxRuntime) {
|
|
21
|
+
configResult.push({
|
|
22
|
+
...reactPlugin.configs.flat["jsx-runtime"],
|
|
23
|
+
files,
|
|
24
|
+
name: "react/jsx-runtime",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
23
27
|
const override = sections.getNamedSection(configResult, "keeex/react");
|
|
24
28
|
override.files = files;
|
|
25
29
|
sections.sectionAddOption(override, "settings", "react", {version: "detect"});
|
|
@@ -46,7 +50,7 @@ export const apply = (configResult, eslintConfig) => {
|
|
|
46
50
|
"jsx-max-depth": ["warn", {max: 8}],
|
|
47
51
|
"jsx-no-bind": "error",
|
|
48
52
|
"jsx-no-constructed-context-values": "error",
|
|
49
|
-
"jsx-no-leaked-render":
|
|
53
|
+
"jsx-no-leaked-render": "warn",
|
|
50
54
|
"jsx-no-script-url": "error",
|
|
51
55
|
"jsx-no-useless-fragment": "warn",
|
|
52
56
|
"jsx-pascal-case": ["warn", {allowNamespace: true}],
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/** Normalize the user configuration for react */
|
|
2
2
|
export const getReactFullConfig = (configEntry) => {
|
|
3
3
|
if (typeof configEntry === "boolean") {
|
|
4
|
-
if (configEntry)
|
|
5
|
-
|
|
4
|
+
if (configEntry) {
|
|
5
|
+
return {
|
|
6
|
+
newJsxRuntime: false,
|
|
7
|
+
react: true,
|
|
8
|
+
reactHooks: false,
|
|
9
|
+
reactNative: false,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return {newJsxRuntime: false, react: false, reactHooks: false, reactNative: false};
|
|
6
13
|
}
|
|
7
14
|
const cfg = {
|
|
15
|
+
newJsxRuntime: configEntry?.newJsxRuntime ?? false,
|
|
8
16
|
react: true,
|
|
9
17
|
reactHooks: configEntry?.reactHooks ?? false,
|
|
10
18
|
reactNative: configEntry?.reactNative ?? false,
|