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