@bratislava/eslint-config-next 0.5.1 → 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 +18 -18
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import tailwindcss from "eslint-plugin-tailwindcss";
|
|
|
17
17
|
import globals from "globals";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* React-specific rules
|
|
20
|
+
* React-specific rules overrides
|
|
21
21
|
*/
|
|
22
22
|
export const reactRules = {
|
|
23
23
|
"react/function-component-definition": [
|
|
@@ -28,6 +28,10 @@ export const reactRules = {
|
|
|
28
28
|
"react/react-in-jsx-scope": "off",
|
|
29
29
|
"react/jsx-no-useless-fragment": [2, { allowExpressions: true }],
|
|
30
30
|
"react/display-name": "off",
|
|
31
|
+
"react/no-array-index-key": "warn",
|
|
32
|
+
"react/destructuring-assignment": "warn",
|
|
33
|
+
"react/no-unused-prop-types": "warn",
|
|
34
|
+
"react/style-prop-object": "warn",
|
|
31
35
|
};
|
|
32
36
|
|
|
33
37
|
/**
|
|
@@ -44,14 +48,6 @@ export const importRules = {
|
|
|
44
48
|
"import/no-named-as-default-member": "off",
|
|
45
49
|
};
|
|
46
50
|
|
|
47
|
-
/**
|
|
48
|
-
* JSX A11y rules
|
|
49
|
-
*/
|
|
50
|
-
export const jsxA11yRules = {
|
|
51
|
-
"jsx-a11y/anchor-is-valid": "off",
|
|
52
|
-
"jsx-a11y/img-redundant-alt": "warn",
|
|
53
|
-
};
|
|
54
|
-
|
|
55
51
|
/**
|
|
56
52
|
* Next.js-specific rules
|
|
57
53
|
*/
|
|
@@ -86,6 +82,8 @@ const frontendRules = {
|
|
|
86
82
|
],
|
|
87
83
|
"@typescript-eslint/no-floating-promises": "warn",
|
|
88
84
|
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
85
|
+
|
|
86
|
+
"jsx-a11y/control-has-associated-label": "warn",
|
|
89
87
|
};
|
|
90
88
|
|
|
91
89
|
/**
|
|
@@ -114,21 +112,21 @@ export function createNextConfig(options = {}) {
|
|
|
114
112
|
nextPlugin.flatConfig.recommended,
|
|
115
113
|
nextPlugin.flatConfig.coreWebVitals,
|
|
116
114
|
|
|
117
|
-
// React hooks recommended
|
|
115
|
+
// React & React hooks recommended configs
|
|
118
116
|
reactHooks.configs.flat.recommended,
|
|
117
|
+
react.configs.flat.recommended,
|
|
118
|
+
react.configs.flat["jsx-runtime"], // Recommended by the docs if using React 17+
|
|
119
119
|
|
|
120
|
-
//
|
|
120
|
+
// JSX A11y recommended config
|
|
121
|
+
jsxA11y.flatConfigs.recommended,
|
|
122
|
+
|
|
123
|
+
// Import rules and plugins
|
|
121
124
|
{
|
|
122
125
|
plugins: {
|
|
123
|
-
react,
|
|
124
126
|
import: importPlugin,
|
|
125
|
-
"jsx-a11y": jsxA11y,
|
|
126
127
|
},
|
|
127
128
|
rules: {
|
|
128
|
-
...reactRules,
|
|
129
129
|
...importRules,
|
|
130
|
-
...jsxA11yRules,
|
|
131
|
-
...nextRules,
|
|
132
130
|
},
|
|
133
131
|
},
|
|
134
132
|
|
|
@@ -147,11 +145,13 @@ export function createNextConfig(options = {}) {
|
|
|
147
145
|
...tanstackQuery.configs["flat/recommended"],
|
|
148
146
|
...tailwindcss.configs["flat/recommended"],
|
|
149
147
|
|
|
150
|
-
// Frontend
|
|
148
|
+
// Frontend rules and overrieds
|
|
151
149
|
{
|
|
152
150
|
rules: {
|
|
153
151
|
...frontendRules,
|
|
154
|
-
|
|
152
|
+
...reactRules,
|
|
153
|
+
...nextRules,
|
|
154
|
+
"sonarjs/different-types-comparison": "off", // TODO consider removing
|
|
155
155
|
},
|
|
156
156
|
},
|
|
157
157
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bratislava/eslint-config-next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "ESLint configuration for Next.js frontend projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"typescript": ">= 5"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@bratislava/eslint-config": "0.
|
|
34
|
+
"@bratislava/eslint-config": "0.6.0",
|
|
35
35
|
"@next/eslint-plugin-next": "15.5.2",
|
|
36
36
|
"@tanstack/eslint-plugin-query": "5.91.2",
|
|
37
37
|
"eslint-plugin-i18next": "6.1.3",
|
|
38
38
|
"eslint-plugin-import": "2.32.0",
|
|
39
39
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
40
40
|
"eslint-plugin-react": "7.37.5",
|
|
41
|
-
"eslint-plugin-react-hooks": "
|
|
41
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
42
42
|
"eslint-plugin-tailwindcss": "3.18.2",
|
|
43
43
|
"globals": "16.5.0"
|
|
44
44
|
},
|