@bratislava/eslint-config-react 0.5.2 → 0.6.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.js +17 -17
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import tailwindcss from "eslint-plugin-tailwindcss";
|
|
|
15
15
|
import globals from "globals";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* React-specific rules
|
|
18
|
+
* React-specific rules overrides
|
|
19
19
|
*/
|
|
20
20
|
export const reactRules = {
|
|
21
21
|
"react/function-component-definition": [
|
|
@@ -26,6 +26,10 @@ export const reactRules = {
|
|
|
26
26
|
"react/react-in-jsx-scope": "off",
|
|
27
27
|
"react/jsx-no-useless-fragment": [2, { allowExpressions: true }],
|
|
28
28
|
"react/display-name": "off",
|
|
29
|
+
"react/no-array-index-key": "warn",
|
|
30
|
+
"react/destructuring-assignment": "warn",
|
|
31
|
+
"react/no-unused-prop-types": "warn",
|
|
32
|
+
"react/style-prop-object": "warn",
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
/**
|
|
@@ -42,14 +46,6 @@ export const importRules = {
|
|
|
42
46
|
"import/no-named-as-default-member": "off",
|
|
43
47
|
};
|
|
44
48
|
|
|
45
|
-
/**
|
|
46
|
-
* JSX A11y rules
|
|
47
|
-
*/
|
|
48
|
-
export const jsxA11yRules = {
|
|
49
|
-
"jsx-a11y/anchor-is-valid": "off",
|
|
50
|
-
"jsx-a11y/img-redundant-alt": "warn",
|
|
51
|
-
};
|
|
52
|
-
|
|
53
49
|
/**
|
|
54
50
|
* Frontend-specific rules
|
|
55
51
|
*/
|
|
@@ -73,6 +69,8 @@ const frontendRules = {
|
|
|
73
69
|
],
|
|
74
70
|
"@typescript-eslint/no-floating-promises": "warn",
|
|
75
71
|
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
72
|
+
|
|
73
|
+
"jsx-a11y/control-has-associated-label": "warn",
|
|
76
74
|
};
|
|
77
75
|
|
|
78
76
|
/**
|
|
@@ -101,20 +99,21 @@ export function createReactConfig(options = {}) {
|
|
|
101
99
|
...tanstackQuery.configs["flat/recommended"],
|
|
102
100
|
...tailwindcss.configs["flat/recommended"],
|
|
103
101
|
|
|
104
|
-
// React hooks recommended
|
|
102
|
+
// React & React hooks recommended configs
|
|
105
103
|
reactHooks.configs.flat.recommended,
|
|
104
|
+
react.configs.flat.recommended,
|
|
105
|
+
react.configs.flat["jsx-runtime"], // Recommended by the docs if using React 17+
|
|
106
|
+
|
|
107
|
+
// JSX A11y recommended config
|
|
108
|
+
jsxA11y.flatConfigs.recommended,
|
|
106
109
|
|
|
107
|
-
//
|
|
110
|
+
// Import rules and plugins
|
|
108
111
|
{
|
|
109
112
|
plugins: {
|
|
110
|
-
react,
|
|
111
113
|
import: importPlugin,
|
|
112
|
-
"jsx-a11y": jsxA11y,
|
|
113
114
|
},
|
|
114
115
|
rules: {
|
|
115
|
-
...reactRules,
|
|
116
116
|
...importRules,
|
|
117
|
-
...jsxA11yRules,
|
|
118
117
|
},
|
|
119
118
|
},
|
|
120
119
|
|
|
@@ -141,11 +140,12 @@ export function createReactConfig(options = {}) {
|
|
|
141
140
|
},
|
|
142
141
|
},
|
|
143
142
|
|
|
144
|
-
// Frontend
|
|
143
|
+
// Frontend rules and overrides
|
|
145
144
|
{
|
|
146
145
|
rules: {
|
|
147
146
|
...frontendRules,
|
|
148
|
-
|
|
147
|
+
...reactRules,
|
|
148
|
+
"sonarjs/different-types-comparison": "off", // TODO consider removing
|
|
149
149
|
},
|
|
150
150
|
},
|
|
151
151
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/eslint-config-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "ESLint configuration for React projects (without Next.js)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typescript": ">= 5"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@bratislava/eslint-config": "0.
|
|
32
|
+
"@bratislava/eslint-config": "0.6.0",
|
|
33
33
|
"@tanstack/eslint-plugin-query": "5.91.2",
|
|
34
34
|
"eslint-plugin-import": "2.32.0",
|
|
35
35
|
"eslint-plugin-jsx-a11y": "6.10.2",
|