@nice-move/eslint-config-react 0.15.10 → 0.16.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/index.mjs +27 -3
- package/package.json +6 -5
package/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fixupPluginRules } from '@eslint/compat';
|
|
1
2
|
import { FlatCompat } from '@eslint/eslintrc';
|
|
2
3
|
import { create } from '@nice-move/eslint-config-base';
|
|
3
4
|
import hooks from 'eslint-config-airbnb/hooks';
|
|
@@ -5,6 +6,7 @@ import airbnb from 'eslint-config-airbnb/rules/react';
|
|
|
5
6
|
import airbnb2 from 'eslint-config-airbnb/rules/react-a11y';
|
|
6
7
|
import prettier from 'eslint-config-prettier';
|
|
7
8
|
import reactPlugin from 'eslint-plugin-react';
|
|
9
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
8
10
|
|
|
9
11
|
import react from './lib/react.mjs';
|
|
10
12
|
|
|
@@ -13,12 +15,27 @@ const compat = new FlatCompat({
|
|
|
13
15
|
resolvePluginsRelativeTo: import.meta.__dirname,
|
|
14
16
|
});
|
|
15
17
|
|
|
18
|
+
// `eslint-plugin-react` still relies on `context` members removed in eslint 10
|
|
19
|
+
function fixup(config) {
|
|
20
|
+
if (!config.plugins?.react) {
|
|
21
|
+
return config;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
...config,
|
|
26
|
+
plugins: {
|
|
27
|
+
...config.plugins,
|
|
28
|
+
react: fixupPluginRules(config.plugins.react),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
const files = ['**/*.{ts,js,tsx,jsx}'];
|
|
17
34
|
|
|
18
35
|
export default [
|
|
19
36
|
...create(
|
|
20
|
-
...compat.config(airbnb).map((config) => ({ ...config, files })),
|
|
21
|
-
...compat.config(airbnb2).map((config) => ({ ...config, files })),
|
|
37
|
+
...compat.config(airbnb).map((config) => fixup({ ...config, files })),
|
|
38
|
+
...compat.config(airbnb2).map((config) => fixup({ ...config, files })),
|
|
22
39
|
),
|
|
23
40
|
{
|
|
24
41
|
files,
|
|
@@ -34,6 +51,13 @@ export default [
|
|
|
34
51
|
...react,
|
|
35
52
|
},
|
|
36
53
|
...compat.config(hooks).map((config) => ({ ...config, files })),
|
|
54
|
+
{
|
|
55
|
+
files,
|
|
56
|
+
plugins: {
|
|
57
|
+
'react-hooks': reactHooks,
|
|
58
|
+
},
|
|
59
|
+
rules: reactHooks.configs.recommended.rules,
|
|
60
|
+
},
|
|
37
61
|
{
|
|
38
62
|
files: ['**/*.md/*'],
|
|
39
63
|
rules: {
|
|
@@ -41,7 +65,7 @@ export default [
|
|
|
41
65
|
'react/jsx-no-undef': 'warn',
|
|
42
66
|
},
|
|
43
67
|
},
|
|
44
|
-
reactPlugin.configs.flat['jsx-runtime'],
|
|
68
|
+
fixup(reactPlugin.configs.flat['jsx-runtime']),
|
|
45
69
|
...compat.config(prettier).map((rule) => ({
|
|
46
70
|
...rule,
|
|
47
71
|
files,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-move/eslint-config-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "A `eslint` config for `react` project best practice",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -36,23 +36,24 @@
|
|
|
36
36
|
"main": "index.mjs",
|
|
37
37
|
"type": "module",
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@eslint/compat": "^2.1.0",
|
|
39
40
|
"@eslint/eslintrc": "^3.3.6",
|
|
40
41
|
"eslint-config-airbnb": "^19.0.4",
|
|
41
42
|
"eslint-config-prettier": "^10.1.8",
|
|
42
43
|
"eslint-plugin-import-x": "^4.17.1",
|
|
43
44
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
44
45
|
"eslint-plugin-react": "^7.37.5",
|
|
45
|
-
"eslint-plugin-react-hooks": "^
|
|
46
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
46
47
|
"globals": "^17.11.0",
|
|
47
48
|
"settingz": "^0.2.0",
|
|
48
49
|
"typescript-eslint": "^8.68.0",
|
|
49
|
-
"@nice-move/eslint-config-base": "^0.
|
|
50
|
+
"@nice-move/eslint-config-base": "^0.16.0"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"eslint": "^9.
|
|
53
|
+
"eslint": "^10.9.1"
|
|
53
54
|
},
|
|
54
55
|
"engines": {
|
|
55
|
-
"node": "
|
|
56
|
+
"node": "^24.0.0"
|
|
56
57
|
},
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public",
|