@geops/eslint-config-react 1.5.0-beta.9 → 1.5.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/README.md +2 -5
- package/flat/index.mjs +28 -40
- package/index.js +10 -1
- package/package.json +6 -7
- package/rules.json +110 -0
- package/confusing-browser-globals.js +0 -62
- package/flat/confusing-browser-globals.mjs +0 -62
- package/flat/rules.mjs +0 -50
- package/package-lock.json +0 -5200
- package/rules.js +0 -50
package/README.md
CHANGED
|
@@ -11,11 +11,9 @@ npm install --save-dev @geops/eslint-config-react
|
|
|
11
11
|
Then, create a `eslint.config.mjs` file in the root of your project with the following content:
|
|
12
12
|
|
|
13
13
|
```javascript
|
|
14
|
-
import geopsFlatConfig from
|
|
14
|
+
import geopsFlatConfig from "@geops/eslint-config-react/flat";
|
|
15
15
|
|
|
16
|
-
export default [
|
|
17
|
-
...geopsFlatConfig,
|
|
18
|
-
];
|
|
16
|
+
export default [...geopsFlatConfig];
|
|
19
17
|
```
|
|
20
18
|
|
|
21
19
|
## Using deprecated config (eslint < 9)
|
|
@@ -31,4 +29,3 @@ Then, create a `.eslintrc.json` file in the root of your project with the follow
|
|
|
31
29
|
## Updating rules
|
|
32
30
|
|
|
33
31
|
If you have to updatethe list of custom rules DO NOT FORGET to add them in `./rules.js` files and in the `flat/rules.mjs` file.
|
|
34
|
-
|
package/flat/index.mjs
CHANGED
|
@@ -1,59 +1,47 @@
|
|
|
1
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
2
1
|
import eslint from "@eslint/js";
|
|
2
|
+
import cypress from "eslint-plugin-cypress/flat";
|
|
3
3
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
4
|
+
import mocha from "eslint-plugin-mocha";
|
|
4
5
|
import perfectionist from "eslint-plugin-perfectionist";
|
|
5
6
|
import prettier from "eslint-plugin-prettier/recommended";
|
|
6
7
|
import react from "eslint-plugin-react";
|
|
7
|
-
import tseslint from "typescript-eslint";
|
|
8
|
-
import pluginCypress from "eslint-plugin-cypress/flat";
|
|
9
|
-
import globals from "globals";
|
|
10
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
|
11
|
-
import rules from "./rules.mjs";
|
|
12
8
|
import reactCompiler from "eslint-plugin-react-compiler";
|
|
13
|
-
import
|
|
9
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
10
|
+
import globals from "globals";
|
|
11
|
+
import tseslint from "typescript-eslint";
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
import rules from "../rules.json" with { type: "json" };
|
|
14
|
+
|
|
15
|
+
export default tseslint.config(
|
|
16
|
+
eslint.configs.recommended,
|
|
17
|
+
tseslint.configs.recommendedTypeChecked,
|
|
18
|
+
tseslint.configs.stylisticTypeChecked,
|
|
19
|
+
cypress.configs.recommended,
|
|
20
|
+
jsxA11y.flatConfigs.recommended,
|
|
21
|
+
mocha.configs.recommended,
|
|
22
|
+
perfectionist.configs["recommended-alphabetical"],
|
|
23
|
+
react.configs.flat.recommended,
|
|
24
|
+
react.configs.flat["jsx-runtime"], // Avoid having the React-in-jsx-scope rule activated
|
|
25
|
+
reactHooks.configs["recommended-latest"],
|
|
26
|
+
reactCompiler.configs.recommended,
|
|
27
|
+
prettier,
|
|
16
28
|
{
|
|
17
|
-
ignores: ["build/*", "node_modules/*"],
|
|
18
29
|
languageOptions: {
|
|
19
30
|
globals: {
|
|
20
31
|
...globals.browser,
|
|
21
32
|
...globals.es2020,
|
|
22
|
-
...globals.node,
|
|
23
33
|
...globals.jest,
|
|
24
34
|
...globals.mocha,
|
|
25
|
-
...globals.
|
|
26
|
-
|
|
35
|
+
...globals.node,
|
|
36
|
+
},
|
|
37
|
+
parserOptions: {
|
|
38
|
+
projectService: true,
|
|
39
|
+
tsconfigRootDir: import.meta.dirname,
|
|
27
40
|
},
|
|
28
41
|
},
|
|
42
|
+
rules: rules,
|
|
29
43
|
settings: {
|
|
30
44
|
react: { version: "detect" },
|
|
31
45
|
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// jestConfig.configs['flat/recommended'],
|
|
35
|
-
...tseslint.config(
|
|
36
|
-
eslint.configs.recommended,
|
|
37
|
-
tseslint.configs.strictTypeChecked,
|
|
38
|
-
tseslint.configs.stylisticTypeChecked,
|
|
39
|
-
{
|
|
40
|
-
languageOptions: {
|
|
41
|
-
parserOptions: {
|
|
42
|
-
projectService: true,
|
|
43
|
-
tsconfigRootDir: import.meta.dirname,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
react.configs.flat.recommended,
|
|
48
|
-
react.configs.flat["jsx-runtime"], // Avoid having the React-in-jsx-scope rule activated
|
|
49
|
-
reactHooks.configs["recommended-latest"],
|
|
50
|
-
reactCompiler.configs.recommended,
|
|
51
|
-
jsxA11y.flatConfigs.recommended,
|
|
52
|
-
mochaPlugin.configs.recommended,
|
|
53
|
-
perfectionist.configs["recommended-alphabetical"],
|
|
54
|
-
prettier,
|
|
55
|
-
{
|
|
56
|
-
rules: rules,
|
|
57
|
-
}
|
|
58
|
-
),
|
|
59
|
-
];
|
|
46
|
+
}
|
|
47
|
+
);
|
package/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const globals = require("globals");
|
|
2
|
+
|
|
3
|
+
const rules = require("./rules.json");
|
|
2
4
|
|
|
3
5
|
module.exports = {
|
|
4
6
|
extends: [
|
|
@@ -14,6 +16,13 @@ module.exports = {
|
|
|
14
16
|
"plugin:react-hooks/recommended",
|
|
15
17
|
"prettier",
|
|
16
18
|
],
|
|
19
|
+
globals: {
|
|
20
|
+
...globals.browser,
|
|
21
|
+
...globals.es2020,
|
|
22
|
+
...globals.jest,
|
|
23
|
+
...globals.mocha,
|
|
24
|
+
...globals.node,
|
|
25
|
+
},
|
|
17
26
|
parser: "@typescript-eslint/parser",
|
|
18
27
|
parserOptions: {
|
|
19
28
|
project: true,
|
package/package.json
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geops/eslint-config-react",
|
|
3
|
-
"version": "1.5.0
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"eslint-config-prettier": "^10.1.
|
|
6
|
-
"eslint-plugin-cypress": "^4.
|
|
7
|
-
"eslint-plugin-jest": "^28.11.0",
|
|
5
|
+
"eslint-config-prettier": "^10.1.3",
|
|
6
|
+
"eslint-plugin-cypress": "^4.3.0",
|
|
8
7
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
9
8
|
"eslint-plugin-mocha": "^11.0.0",
|
|
10
9
|
"eslint-plugin-perfectionist": "^4.12.3",
|
|
11
|
-
"eslint-plugin-prettier": "^5.
|
|
12
|
-
"eslint-plugin-react": "^7.37.
|
|
10
|
+
"eslint-plugin-prettier": "^5.4.0",
|
|
11
|
+
"eslint-plugin-react": "^7.37.5",
|
|
13
12
|
"eslint-plugin-react-compiler": "^19.1.0-rc.1",
|
|
14
13
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
15
14
|
"globals": "^16.0.0",
|
|
16
|
-
"typescript-eslint": "^8.
|
|
15
|
+
"typescript-eslint": "^8.32.0"
|
|
17
16
|
},
|
|
18
17
|
"exports": {
|
|
19
18
|
".": "./index.js",
|
package/rules.json
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"import/order": "off",
|
|
3
|
+
"arrow-body-style": ["error", "always"],
|
|
4
|
+
"curly": "error",
|
|
5
|
+
"no-console": "warn",
|
|
6
|
+
"prefer-template": "error",
|
|
7
|
+
"react-compiler/react-compiler": "error",
|
|
8
|
+
"react-hooks/exhaustive-deps": "error",
|
|
9
|
+
"mocha/no-exclusive-tests": "error",
|
|
10
|
+
"mocha/no-mocha-arrows": "off",
|
|
11
|
+
"mocha/no-pending-tests": "error",
|
|
12
|
+
"no-nested-ternary": "error",
|
|
13
|
+
"no-restricted-globals": [
|
|
14
|
+
"error",
|
|
15
|
+
"addEventListener",
|
|
16
|
+
"blur",
|
|
17
|
+
"close",
|
|
18
|
+
"closed",
|
|
19
|
+
"confirm",
|
|
20
|
+
"defaultStatus",
|
|
21
|
+
"defaultstatus",
|
|
22
|
+
"event",
|
|
23
|
+
"external",
|
|
24
|
+
"find",
|
|
25
|
+
"focus",
|
|
26
|
+
"frameElement",
|
|
27
|
+
"frames",
|
|
28
|
+
"history",
|
|
29
|
+
"innerHeight",
|
|
30
|
+
"innerWidth",
|
|
31
|
+
"isFinite",
|
|
32
|
+
"isNaN",
|
|
33
|
+
"length",
|
|
34
|
+
"location",
|
|
35
|
+
"locationbar",
|
|
36
|
+
"menubar",
|
|
37
|
+
"moveBy",
|
|
38
|
+
"moveTo",
|
|
39
|
+
"name",
|
|
40
|
+
"onblur",
|
|
41
|
+
"onerror",
|
|
42
|
+
"onfocus",
|
|
43
|
+
"onload",
|
|
44
|
+
"onresize",
|
|
45
|
+
"onunload",
|
|
46
|
+
"open",
|
|
47
|
+
"opener",
|
|
48
|
+
"opera",
|
|
49
|
+
"outerHeight",
|
|
50
|
+
"outerWidth",
|
|
51
|
+
"pageXOffset",
|
|
52
|
+
"pageYOffset",
|
|
53
|
+
"parent",
|
|
54
|
+
"print",
|
|
55
|
+
"removeEventListener",
|
|
56
|
+
"resizeBy",
|
|
57
|
+
"resizeTo",
|
|
58
|
+
"screen",
|
|
59
|
+
"screenLeft",
|
|
60
|
+
"screenTop",
|
|
61
|
+
"screenX",
|
|
62
|
+
"screenY",
|
|
63
|
+
"scroll",
|
|
64
|
+
"scrollbars",
|
|
65
|
+
"scrollBy",
|
|
66
|
+
"scrollTo",
|
|
67
|
+
"scrollX",
|
|
68
|
+
"scrollY",
|
|
69
|
+
"self",
|
|
70
|
+
"status",
|
|
71
|
+
"statusbar",
|
|
72
|
+
"stop",
|
|
73
|
+
"toolbar",
|
|
74
|
+
"top"
|
|
75
|
+
],
|
|
76
|
+
"no-param-reassign": "error",
|
|
77
|
+
"perfectionist/sort-imports": [
|
|
78
|
+
"error",
|
|
79
|
+
{
|
|
80
|
+
"groups": [
|
|
81
|
+
"builtin",
|
|
82
|
+
"external",
|
|
83
|
+
"internal",
|
|
84
|
+
"parent",
|
|
85
|
+
"sibling",
|
|
86
|
+
"side-effect",
|
|
87
|
+
"side-effect-style",
|
|
88
|
+
"index",
|
|
89
|
+
"object",
|
|
90
|
+
"style",
|
|
91
|
+
"type",
|
|
92
|
+
"builtin-type",
|
|
93
|
+
"external-type",
|
|
94
|
+
"internal-type",
|
|
95
|
+
"parent-type",
|
|
96
|
+
"sibling-type",
|
|
97
|
+
"index-type",
|
|
98
|
+
"unknown"
|
|
99
|
+
],
|
|
100
|
+
"internalPattern": ["^@/.*"]
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"perfectionist/sort-modules": "off",
|
|
104
|
+
"react/destructuring-assignment": "error",
|
|
105
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
|
106
|
+
"@typescript-eslint/no-shadow": "error",
|
|
107
|
+
"@typescript-eslint/no-use-before-define": "error",
|
|
108
|
+
"@typescript-eslint/no-empty-function": "warn",
|
|
109
|
+
"@typescript-eslint/prefer-nullish-coalescing": "warn"
|
|
110
|
+
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
module.exports = [
|
|
2
|
-
"addEventListener",
|
|
3
|
-
"blur",
|
|
4
|
-
"close",
|
|
5
|
-
"closed",
|
|
6
|
-
"confirm",
|
|
7
|
-
"defaultStatus",
|
|
8
|
-
"defaultstatus",
|
|
9
|
-
"event",
|
|
10
|
-
"external",
|
|
11
|
-
"find",
|
|
12
|
-
"focus",
|
|
13
|
-
"frameElement",
|
|
14
|
-
"frames",
|
|
15
|
-
"history",
|
|
16
|
-
"innerHeight",
|
|
17
|
-
"innerWidth",
|
|
18
|
-
"isFinite",
|
|
19
|
-
"isNaN",
|
|
20
|
-
"length",
|
|
21
|
-
"location",
|
|
22
|
-
"locationbar",
|
|
23
|
-
"menubar",
|
|
24
|
-
"moveBy",
|
|
25
|
-
"moveTo",
|
|
26
|
-
"name",
|
|
27
|
-
"onblur",
|
|
28
|
-
"onerror",
|
|
29
|
-
"onfocus",
|
|
30
|
-
"onload",
|
|
31
|
-
"onresize",
|
|
32
|
-
"onunload",
|
|
33
|
-
"open",
|
|
34
|
-
"opener",
|
|
35
|
-
"opera",
|
|
36
|
-
"outerHeight",
|
|
37
|
-
"outerWidth",
|
|
38
|
-
"pageXOffset",
|
|
39
|
-
"pageYOffset",
|
|
40
|
-
"parent",
|
|
41
|
-
"print",
|
|
42
|
-
"removeEventListener",
|
|
43
|
-
"resizeBy",
|
|
44
|
-
"resizeTo",
|
|
45
|
-
"screen",
|
|
46
|
-
"screenLeft",
|
|
47
|
-
"screenTop",
|
|
48
|
-
"screenX",
|
|
49
|
-
"screenY",
|
|
50
|
-
"scroll",
|
|
51
|
-
"scrollbars",
|
|
52
|
-
"scrollBy",
|
|
53
|
-
"scrollTo",
|
|
54
|
-
"scrollX",
|
|
55
|
-
"scrollY",
|
|
56
|
-
"self",
|
|
57
|
-
"status",
|
|
58
|
-
"statusbar",
|
|
59
|
-
"stop",
|
|
60
|
-
"toolbar",
|
|
61
|
-
"top",
|
|
62
|
-
];
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export default [
|
|
2
|
-
"addEventListener",
|
|
3
|
-
"blur",
|
|
4
|
-
"close",
|
|
5
|
-
"closed",
|
|
6
|
-
"confirm",
|
|
7
|
-
"defaultStatus",
|
|
8
|
-
"defaultstatus",
|
|
9
|
-
"event",
|
|
10
|
-
"external",
|
|
11
|
-
"find",
|
|
12
|
-
"focus",
|
|
13
|
-
"frameElement",
|
|
14
|
-
"frames",
|
|
15
|
-
"history",
|
|
16
|
-
"innerHeight",
|
|
17
|
-
"innerWidth",
|
|
18
|
-
"isFinite",
|
|
19
|
-
"isNaN",
|
|
20
|
-
"length",
|
|
21
|
-
"location",
|
|
22
|
-
"locationbar",
|
|
23
|
-
"menubar",
|
|
24
|
-
"moveBy",
|
|
25
|
-
"moveTo",
|
|
26
|
-
"name",
|
|
27
|
-
"onblur",
|
|
28
|
-
"onerror",
|
|
29
|
-
"onfocus",
|
|
30
|
-
"onload",
|
|
31
|
-
"onresize",
|
|
32
|
-
"onunload",
|
|
33
|
-
"open",
|
|
34
|
-
"opener",
|
|
35
|
-
"opera",
|
|
36
|
-
"outerHeight",
|
|
37
|
-
"outerWidth",
|
|
38
|
-
"pageXOffset",
|
|
39
|
-
"pageYOffset",
|
|
40
|
-
"parent",
|
|
41
|
-
"print",
|
|
42
|
-
"removeEventListener",
|
|
43
|
-
"resizeBy",
|
|
44
|
-
"resizeTo",
|
|
45
|
-
"screen",
|
|
46
|
-
"screenLeft",
|
|
47
|
-
"screenTop",
|
|
48
|
-
"screenX",
|
|
49
|
-
"screenY",
|
|
50
|
-
"scroll",
|
|
51
|
-
"scrollbars",
|
|
52
|
-
"scrollBy",
|
|
53
|
-
"scrollTo",
|
|
54
|
-
"scrollX",
|
|
55
|
-
"scrollY",
|
|
56
|
-
"self",
|
|
57
|
-
"status",
|
|
58
|
-
"statusbar",
|
|
59
|
-
"stop",
|
|
60
|
-
"toolbar",
|
|
61
|
-
"top",
|
|
62
|
-
];
|
package/flat/rules.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import confusingBrowserGlobals from "./confusing-browser-globals.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
"import/order": "off",
|
|
5
|
-
"arrow-body-style": ["error", "always"],
|
|
6
|
-
curly: "error",
|
|
7
|
-
"no-console": "warn",
|
|
8
|
-
"prefer-template": "error",
|
|
9
|
-
"react-compiler/react-compiler": "error",
|
|
10
|
-
"react-hooks/exhaustive-deps": "error",
|
|
11
|
-
// "mocha/no-exclusive-tests": "error",
|
|
12
|
-
// "mocha/no-skipped-tests": "error",
|
|
13
|
-
// "mocha/no-mocha-arrows": "off",
|
|
14
|
-
"no-nested-ternary": "error",
|
|
15
|
-
"no-restricted-globals": ["error"].concat(confusingBrowserGlobals),
|
|
16
|
-
"no-param-reassign": "error",
|
|
17
|
-
"perfectionist/sort-imports": [
|
|
18
|
-
"error",
|
|
19
|
-
{
|
|
20
|
-
groups: [
|
|
21
|
-
"builtin",
|
|
22
|
-
"external",
|
|
23
|
-
"internal",
|
|
24
|
-
"parent",
|
|
25
|
-
"sibling",
|
|
26
|
-
"side-effect",
|
|
27
|
-
"side-effect-style",
|
|
28
|
-
"index",
|
|
29
|
-
"object",
|
|
30
|
-
"style",
|
|
31
|
-
"type",
|
|
32
|
-
"builtin-type",
|
|
33
|
-
"external-type",
|
|
34
|
-
"internal-type",
|
|
35
|
-
"parent-type",
|
|
36
|
-
"sibling-type",
|
|
37
|
-
"index-type",
|
|
38
|
-
"unknown",
|
|
39
|
-
],
|
|
40
|
-
internalPattern: ["^@/.*"],
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
"perfectionist/sort-modules": "off",
|
|
44
|
-
"react/destructuring-assignment": "error",
|
|
45
|
-
"@typescript-eslint/consistent-type-imports": "error",
|
|
46
|
-
"@typescript-eslint/no-shadow": "error",
|
|
47
|
-
"@typescript-eslint/no-use-before-define": "error",
|
|
48
|
-
"@typescript-eslint/no-empty-function": "warn",
|
|
49
|
-
"@typescript-eslint/prefer-nullish-coalescing": "warn",
|
|
50
|
-
};
|