@geops/eslint-config-react 1.5.0-beta.0 → 1.5.0-beta.10

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 CHANGED
@@ -8,14 +8,12 @@ npm install --save-dev @geops/eslint-config-react
8
8
 
9
9
  ## Using flat config (eslint >= 9)
10
10
 
11
- Then, create a `.eslintrc.mjs` file in the root of your project with the following content:
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 '@geops/eslint-config-react/flat';
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)
@@ -28,4 +26,6 @@ Then, create a `.eslintrc.json` file in the root of your project with the follow
28
26
  }
29
27
  ```
30
28
 
29
+ ## Updating rules
31
30
 
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.
package/flat/index.mjs CHANGED
@@ -1,58 +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 tailwind from "eslint-plugin-tailwindcss";
8
- import tseslint from "typescript-eslint";
9
- import pluginCypress from 'eslint-plugin-cypress/flat';
8
+ import reactCompiler from "eslint-plugin-react-compiler";
9
+ import reactHooks from "eslint-plugin-react-hooks";
10
10
  import globals from "globals";
11
- // FlatCompat convert old definition to the new ones
12
- const compat = new FlatCompat();
11
+ import tseslint from "typescript-eslint";
12
+
13
+ import rules from "../rules.json";
13
14
 
14
- export default [
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,
15
28
  {
16
- ignores: ["build/*", "node_modules/*"],
17
29
  languageOptions: {
18
30
  globals: {
19
31
  ...globals.browser,
20
32
  ...globals.es2020,
21
- ...globals.node,
22
33
  ...globals.jest,
23
34
  ...globals.mocha,
24
- ...globals.vitest,
25
- ...pluginCypress.globals,
26
- }
35
+ ...globals.node,
36
+ },
37
+ parserOptions: {
38
+ projectService: true,
39
+ tsconfigRootDir: import.meta.dirname,
40
+ },
27
41
  },
42
+ rules: rules,
28
43
  settings: {
29
44
  react: { version: "detect" },
30
45
  },
31
46
  },
32
- pluginCypress.configs.globals,
33
- // jestConfig.configs['flat/recommended'],
34
- ...tseslint.config(
35
- eslint.configs.recommended,
36
- tseslint.configs.strict,
37
- tseslint.configs.stylistic,
38
- react.configs.flat.recommended,
39
- react.configs.flat["jsx-runtime"], // Avoid having the React-in-jsx-scope rule activated
40
- ...compat.config({
41
- extends: ["plugin:react-hooks/recommended"],
42
- rules: {
43
- "react-hooks/exhaustive-deps": "error",
44
- },
45
- }),
46
- jsxA11y.flatConfigs.recommended,
47
- perfectionist.configs["recommended-alphabetical"],
48
- prettier,
49
- ...tailwind.configs["flat/recommended"],
50
- {
51
- rules: {
52
- "arrow-body-style": ["error", "always"],
53
- curly: "error",
54
- "@typescript-eslint/no-empty-function": "off",
55
- },
56
- },
57
- ),
58
- ];
47
+ );
package/index.js CHANGED
@@ -1,4 +1,6 @@
1
- const confusingBrowserGlobals = require("./confusing-browser-globals");
1
+ const globals = require("globals");
2
+
3
+ const rules = require("./rules.json");
2
4
 
3
5
  module.exports = {
4
6
  extends: [
@@ -14,52 +16,19 @@ 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,
20
29
  },
21
30
  plugins: ["eslint-plugin-react-compiler"],
22
- rules: {
23
- "import/order": "off",
24
- "jsx-a11y/click-events-have-key-events": "error",
25
- "perfectionist/sort-imports": [
26
- "error",
27
- {
28
- groups: [
29
- "builtin",
30
- "external",
31
- "internal",
32
- "parent",
33
- "sibling",
34
- "side-effect",
35
- "side-effect-style",
36
- "index",
37
- "object",
38
- "style",
39
- "type",
40
- "builtin-type",
41
- "external-type",
42
- "internal-type",
43
- "parent-type",
44
- "sibling-type",
45
- "index-type",
46
- "unknown",
47
- ],
48
- internalPattern: ["^@/.*"],
49
- },
50
- ],
51
- "mocha/no-exclusive-tests": "error",
52
- "mocha/no-skipped-tests": "error",
53
- "mocha/no-mocha-arrows": "off",
54
- "no-nested-ternary": "error",
55
- "no-param-reassign": "error",
56
- "no-restricted-globals": ["error"].concat(confusingBrowserGlobals),
57
- "perfectionist/sort-modules": "off",
58
- "react-compiler/react-compiler": "error",
59
- "react/destructuring-assignment": "error",
60
- "@typescript-eslint/no-shadow": "error",
61
- "@typescript-eslint/no-use-before-define": "error",
62
- },
31
+ rules: rules,
63
32
  settings: {
64
33
  react: { version: "detect" },
65
34
  },
package/package.json CHANGED
@@ -1,20 +1,19 @@
1
1
  {
2
2
  "name": "@geops/eslint-config-react",
3
- "version": "1.5.0-beta.0",
3
+ "version": "1.5.0-beta.10",
4
4
  "dependencies": {
5
- "eslint-config-prettier": "^10.0.1",
6
- "eslint-plugin-cypress": "^4.1.0",
5
+ "eslint-config-prettier": "^10.1.2",
6
+ "eslint-plugin-cypress": "^4.3.0",
7
7
  "eslint-plugin-jest": "^28.11.0",
8
8
  "eslint-plugin-jsx-a11y": "^6.10.2",
9
- "eslint-plugin-mocha": "^10.5.0",
10
- "eslint-plugin-perfectionist": "^4.7.0",
11
- "eslint-plugin-prettier": "^5.2.3",
12
- "eslint-plugin-react": "^7.37.4",
13
- "eslint-plugin-react-compiler": "^19.0.0-beta-27714ef-20250124",
14
- "eslint-plugin-react-hooks": "^5.1.0",
15
- "eslint-plugin-tailwindcss": "^3.18.0",
16
- "globals": "^15.14.0",
17
- "typescript-eslint": "^8.22.0"
9
+ "eslint-plugin-mocha": "^11.0.0",
10
+ "eslint-plugin-perfectionist": "^4.12.3",
11
+ "eslint-plugin-prettier": "^5.4.0",
12
+ "eslint-plugin-react": "^7.37.5",
13
+ "eslint-plugin-react-compiler": "^19.1.0-rc.1",
14
+ "eslint-plugin-react-hooks": "^5.2.0",
15
+ "globals": "^16.0.0",
16
+ "typescript-eslint": "^8.32.0"
18
17
  },
19
18
  "exports": {
20
19
  ".": "./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-skipped-tests": "error",
11
+ "mocha/no-mocha-arrows": "off",
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
- ];