@scaleway/eslint-config-react 5.2.10 → 5.2.12

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.
@@ -1,7 +1,7 @@
1
- import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
2
- import { FlatCompat } from '@eslint/eslintrc'
3
1
  import path from 'node:path'
4
2
  import { fileURLToPath } from 'node:url'
3
+ import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
4
+ import { FlatCompat } from '@eslint/eslintrc'
5
5
 
6
6
  const filename = fileURLToPath(import.meta.url)
7
7
  const dirname = path.dirname(filename)
@@ -20,124 +20,164 @@ const defaultAirBnbRules = [...fixupPluginRules(config)].reduce(
20
20
  {},
21
21
  )
22
22
 
23
- export default [
23
+ const defaultAirbnb = [
24
24
  ...fixupConfigRules(compat.extends('airbnb-base')),
25
25
  {
26
26
  rules: {
27
- // Replace Airbnb 'camelcase' rule with '@typescript-eslint/naming-convention'
28
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
29
- camelcase: 'off',
27
+ '@typescript-eslint/default-param-last':
28
+ defaultAirBnbRules['default-param-last'],
29
+ '@typescript-eslint/dot-notation': defaultAirBnbRules['dot-notation'],
30
30
  // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
31
31
  '@typescript-eslint/naming-convention': [
32
32
  'error',
33
33
  // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
34
34
  {
35
- selector: 'variable',
36
35
  format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
36
+ selector: 'variable',
37
37
  },
38
38
  // Allow camelCase functions (23.2), and PascalCase functions (23.8)
39
39
  {
40
- selector: 'function',
41
40
  format: ['camelCase', 'PascalCase'],
41
+ selector: 'function',
42
42
  },
43
43
  // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums
44
44
  {
45
- selector: 'typeLike',
46
45
  format: ['PascalCase'],
46
+ selector: 'typeLike',
47
47
  },
48
48
  ],
49
+ '@typescript-eslint/no-array-constructor':
50
+ defaultAirBnbRules['no-array-constructor'],
51
+ '@typescript-eslint/no-dupe-class-members':
52
+ defaultAirBnbRules['no-dupe-class-members'],
53
+ '@typescript-eslint/no-empty-function':
54
+ defaultAirBnbRules['no-empty-function'],
55
+ '@typescript-eslint/no-extra-parens':
56
+ defaultAirBnbRules['no-extra-parens'],
57
+ '@typescript-eslint/no-implied-eval':
58
+ defaultAirBnbRules['no-implied-eval'],
59
+ '@typescript-eslint/no-loop-func': defaultAirBnbRules['no-loop-func'],
60
+ '@typescript-eslint/no-loss-of-precision':
61
+ defaultAirBnbRules['no-loss-of-precision'],
62
+ '@typescript-eslint/no-magic-numbers':
63
+ defaultAirBnbRules['no-magic-numbers'],
64
+ '@typescript-eslint/no-redeclare': defaultAirBnbRules['no-redeclare'],
65
+ '@typescript-eslint/no-shadow': defaultAirBnbRules['no-shadow'],
66
+ '@typescript-eslint/no-unused-expressions':
67
+ defaultAirBnbRules['no-unused-expressions'],
68
+ '@typescript-eslint/no-unused-vars': defaultAirBnbRules['no-unused-vars'],
69
+ '@typescript-eslint/no-use-before-define':
70
+ defaultAirBnbRules['no-use-before-define'],
71
+ '@typescript-eslint/no-useless-constructor':
72
+ defaultAirBnbRules['no-useless-constructor'],
73
+ '@typescript-eslint/require-await': defaultAirBnbRules['require-await'],
74
+ '@typescript-eslint/return-await': [
75
+ defaultAirBnbRules['no-return-await'],
76
+ 'in-try-catch',
77
+ ],
78
+ // Replace Airbnb 'camelcase' rule with '@typescript-eslint/naming-convention'
79
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md
80
+ camelcase: 'off',
49
81
 
50
82
  // Replace Airbnb 'default-param-last' rule with '@typescript-eslint' version
51
83
  // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/default-param-last.md
52
84
  'default-param-last': 'off',
53
- '@typescript-eslint/default-param-last':
54
- defaultAirBnbRules['default-param-last'],
55
85
 
56
86
  // Replace Airbnb 'dot-notation' rule with '@typescript-eslint' version
57
87
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/dot-notation.md
58
88
  'dot-notation': 'off',
59
- '@typescript-eslint/dot-notation': defaultAirBnbRules['dot-notation'],
89
+
90
+ // Append 'ts' and 'tsx' to Airbnb 'import/extensions' rule
91
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
92
+ 'import/extensions': [
93
+ defaultAirBnbRules['import/extensions'][0],
94
+ defaultAirBnbRules['import/extensions'][1],
95
+ {
96
+ ...defaultAirBnbRules['import/extensions'][2],
97
+ ts: 'never',
98
+ tsx: 'never',
99
+ },
100
+ ],
101
+
102
+ // Append 'ts' and 'tsx' extensions to Airbnb 'import/no-extraneous-dependencies' rule
103
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
104
+ 'import/no-extraneous-dependencies': [
105
+ defaultAirBnbRules['import/no-extraneous-dependencies'][0],
106
+ {
107
+ ...defaultAirBnbRules['import/no-extraneous-dependencies'][1],
108
+ devDependencies: defaultAirBnbRules[
109
+ 'import/no-extraneous-dependencies'
110
+ ][1].devDependencies.reduce((result, devDep) => {
111
+ const toAppend = [devDep]
112
+ const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, 'ts$1')
113
+ if (devDepWithTs !== devDep) {
114
+ toAppend.push(devDepWithTs)
115
+ }
116
+ return [...result, ...toAppend]
117
+ }, []),
118
+ },
119
+ ],
60
120
 
61
121
  // Replace Airbnb 'no-array-constructor' rule with '@typescript-eslint' version
62
122
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-array-constructor.md
63
123
  'no-array-constructor': 'off',
64
- '@typescript-eslint/no-array-constructor':
65
- defaultAirBnbRules['no-array-constructor'],
66
124
 
67
125
  // Replace Airbnb 'no-dupe-class-members' rule with '@typescript-eslint' version
68
126
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-dupe-class-members.md
69
127
  'no-dupe-class-members': 'off',
70
- '@typescript-eslint/no-dupe-class-members':
71
- defaultAirBnbRules['no-dupe-class-members'],
72
128
 
73
129
  // Replace Airbnb 'no-empty-function' rule with '@typescript-eslint' version
74
130
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-empty-function.md
75
131
  'no-empty-function': 'off',
76
- '@typescript-eslint/no-empty-function':
77
- defaultAirBnbRules['no-empty-function'],
78
132
 
79
133
  // Replace Airbnb 'no-extra-parens' rule with '@typescript-eslint' version
80
134
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-extra-parens.md
81
135
  'no-extra-parens': 'off',
82
- '@typescript-eslint/no-extra-parens':
83
- defaultAirBnbRules['no-extra-parens'],
84
136
 
85
137
  // Replace Airbnb 'no-implied-eval' and 'no-new-func' rules with '@typescript-eslint' version
86
138
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-implied-eval.md
87
139
  'no-implied-eval': 'off',
88
- 'no-new-func': 'off',
89
- '@typescript-eslint/no-implied-eval':
90
- defaultAirBnbRules['no-implied-eval'],
91
-
92
- // Replace Airbnb 'no-loss-of-precision' rule with '@typescript-eslint' version
93
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
94
- 'no-loss-of-precision': 'off',
95
- '@typescript-eslint/no-loss-of-precision':
96
- defaultAirBnbRules['no-loss-of-precision'],
97
140
 
98
141
  // Replace Airbnb 'no-loop-func' rule with '@typescript-eslint' version
99
142
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loop-func.md
100
143
  'no-loop-func': 'off',
101
- '@typescript-eslint/no-loop-func': defaultAirBnbRules['no-loop-func'],
144
+
145
+ // Replace Airbnb 'no-loss-of-precision' rule with '@typescript-eslint' version
146
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-loss-of-precision.md
147
+ 'no-loss-of-precision': 'off',
102
148
 
103
149
  // Replace Airbnb 'no-magic-numbers' rule with '@typescript-eslint' version
104
150
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-magic-numbers.md
105
151
  'no-magic-numbers': 'off',
106
- '@typescript-eslint/no-magic-numbers':
107
- defaultAirBnbRules['no-magic-numbers'],
152
+ 'no-new-func': 'off',
108
153
 
109
154
  // Replace Airbnb 'no-redeclare' rule with '@typescript-eslint' version
110
155
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
111
156
  'no-redeclare': 'off',
112
- '@typescript-eslint/no-redeclare': defaultAirBnbRules['no-redeclare'],
157
+
158
+ // Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
159
+ // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
160
+ 'no-return-await': 'off',
113
161
 
114
162
  // Replace Airbnb 'no-shadow' rule with '@typescript-eslint' version
115
163
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
116
164
  'no-shadow': 'off',
117
- '@typescript-eslint/no-shadow': defaultAirBnbRules['no-shadow'],
118
165
 
119
166
  // Replace Airbnb 'no-unused-expressions' rule with '@typescript-eslint' version
120
167
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-expressions.md
121
168
  'no-unused-expressions': 'off',
122
- '@typescript-eslint/no-unused-expressions':
123
- defaultAirBnbRules['no-unused-expressions'],
124
169
 
125
170
  // Replace Airbnb 'no-unused-vars' rule with '@typescript-eslint' version
126
171
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md
127
172
  'no-unused-vars': 'off',
128
- '@typescript-eslint/no-unused-vars': defaultAirBnbRules['no-unused-vars'],
129
173
 
130
174
  // Replace Airbnb 'no-use-before-define' rule with '@typescript-eslint' version
131
175
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md
132
176
  'no-use-before-define': 'off',
133
- '@typescript-eslint/no-use-before-define':
134
- defaultAirBnbRules['no-use-before-define'],
135
177
 
136
178
  // Replace Airbnb 'no-useless-constructor' rule with '@typescript-eslint' version
137
179
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-useless-constructor.md
138
180
  'no-useless-constructor': 'off',
139
- '@typescript-eslint/no-useless-constructor':
140
- defaultAirBnbRules['no-useless-constructor'],
141
181
 
142
182
  // Replace Airbnb 'quotes' rule with '@typescript-eslint' version
143
183
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
@@ -147,46 +187,8 @@ export default [
147
187
  // Replace Airbnb 'require-await' rule with '@typescript-eslint' version
148
188
  // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/require-await.md
149
189
  'require-await': 'off',
150
- '@typescript-eslint/require-await': defaultAirBnbRules['require-await'],
151
-
152
- // Replace Airbnb 'no-return-await' rule with '@typescript-eslint' version
153
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/return-await.md
154
- 'no-return-await': 'off',
155
- '@typescript-eslint/return-await': [
156
- defaultAirBnbRules['no-return-await'],
157
- 'in-try-catch',
158
- ],
159
-
160
- // Append 'ts' and 'tsx' to Airbnb 'import/extensions' rule
161
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
162
- 'import/extensions': [
163
- defaultAirBnbRules['import/extensions'][0],
164
- defaultAirBnbRules['import/extensions'][1],
165
- {
166
- ...defaultAirBnbRules['import/extensions'][2],
167
- ts: 'never',
168
- tsx: 'never',
169
- },
170
- ],
171
-
172
- // Append 'ts' and 'tsx' extensions to Airbnb 'import/no-extraneous-dependencies' rule
173
- // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
174
- 'import/no-extraneous-dependencies': [
175
- defaultAirBnbRules['import/no-extraneous-dependencies'][0],
176
- {
177
- ...defaultAirBnbRules['import/no-extraneous-dependencies'][1],
178
- devDependencies: defaultAirBnbRules[
179
- 'import/no-extraneous-dependencies'
180
- ][1].devDependencies.reduce((result, devDep) => {
181
- const toAppend = [devDep]
182
- const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, 'ts$1')
183
- if (devDepWithTs !== devDep) {
184
- toAppend.push(devDepWithTs)
185
- }
186
- return [...result, ...toAppend]
187
- }, []),
188
- },
189
- ],
190
190
  },
191
191
  },
192
192
  ]
193
+
194
+ export default defaultAirbnb
package/emotion.mjs CHANGED
@@ -1,24 +1,25 @@
1
1
  import { rules } from '@emotion/eslint-plugin'
2
2
  import { fixupPluginRules } from '@eslint/compat'
3
3
 
4
- export default [
4
+ export const defaultEmotionRules = [
5
5
  {
6
6
  plugins: {
7
7
  '@emotion': fixupPluginRules({ rules }),
8
8
  },
9
9
 
10
10
  rules: {
11
+ '@emotion/import-from-emotion': 'error',
12
+ '@emotion/no-vanilla': 'error',
13
+ '@emotion/styled-import': 'error',
14
+ '@emotion/syntax-preference': ['error', 'string'],
11
15
  'react/no-unknown-property': [
12
16
  'error',
13
17
  {
14
18
  ignore: ['css'],
15
19
  },
16
20
  ],
17
-
18
- '@emotion/import-from-emotion': 'error',
19
- '@emotion/no-vanilla': 'error',
20
- '@emotion/styled-import': 'error',
21
- '@emotion/syntax-preference': ['error', 'string'],
22
21
  },
23
22
  },
24
23
  ]
24
+
25
+ export default defaultEmotionRules
package/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
- import emotion from './emotion.mjs'
2
- import javascript from './javascript.mjs'
3
- import typescript from './typescript.mjs'
4
- import stylistic from './stylistic.mjs'
1
+ import { defaultEmotionRules } from './emotion.mjs'
2
+ import { defaultJavascriptRules } from './javascript.mjs'
3
+ import { defaultStylisticRules } from './stylistic.mjs'
4
+ import { defaultTypescriptRules } from './typescript.mjs'
5
5
 
6
- export { emotion, javascript, stylistic, typescript }
6
+ export const emotion = defaultEmotionRules
7
+ export const javascript = defaultJavascriptRules
8
+ export const stylistic = defaultStylisticRules
9
+ export const typescript = defaultTypescriptRules
package/javascript.mjs CHANGED
@@ -1,8 +1,8 @@
1
+ import path from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
1
3
  import { fixupConfigRules } from '@eslint/compat'
2
4
  import { FlatCompat } from '@eslint/eslintrc'
3
5
  import airbnb from 'eslint-config-airbnb'
4
- import path from 'node:path'
5
- import { fileURLToPath } from 'node:url'
6
6
  import shared from './shared.mjs'
7
7
 
8
8
  const filename = fileURLToPath(import.meta.url)
@@ -12,7 +12,7 @@ const compat = new FlatCompat({
12
12
  baseDirectory: dirname,
13
13
  })
14
14
 
15
- export default [
15
+ export const defaultJavascriptRules = [
16
16
  ...fixupConfigRules(compat.config(airbnb)),
17
17
  ...shared,
18
18
  {
@@ -26,3 +26,5 @@ export default [
26
26
  },
27
27
  },
28
28
  ]
29
+
30
+ export default defaultJavascriptRules
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/eslint-config-react",
3
- "version": "5.2.10",
3
+ "version": "5.2.12",
4
4
  "description": "Scaleway React eslint shared config",
5
5
  "keywords": [
6
6
  "eslint",
@@ -35,25 +35,25 @@
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
37
  "@emotion/eslint-plugin": "11.12.0",
38
- "@eslint/compat": "1.2.9",
39
- "@eslint/eslintrc": "3.3.1",
40
- "@stylistic/eslint-plugin": "4.4.1",
41
- "@typescript-eslint/eslint-plugin": "8.33.1",
42
- "@typescript-eslint/parser": "8.33.1",
38
+ "@eslint/compat": "2.0.0",
39
+ "@eslint/eslintrc": "3.3.3",
40
+ "@stylistic/eslint-plugin": "5.6.1",
41
+ "@typescript-eslint/eslint-plugin": "8.52.0",
42
+ "@typescript-eslint/parser": "8.52.0",
43
43
  "eslint-config-airbnb": "19.0.4",
44
- "eslint-config-prettier": "10.1.5",
45
- "eslint-import-resolver-typescript": "4.4.3",
44
+ "eslint-config-prettier": "10.1.8",
45
+ "eslint-import-resolver-typescript": "4.4.4",
46
46
  "eslint-plugin-eslint-comments": "3.2.0",
47
- "eslint-plugin-import": "2.31.0",
47
+ "eslint-plugin-import": "2.32.0",
48
48
  "eslint-plugin-jsx-a11y": "6.10.2",
49
49
  "eslint-plugin-react": "7.37.5",
50
- "eslint-plugin-react-hooks": "5.2.0"
50
+ "eslint-plugin-react-hooks": "7.0.1"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "eslint": ">= 9.x"
54
54
  },
55
55
  "devDependencies": {
56
- "eslint": "9.28.0",
57
- "typescript": "5.8.3"
56
+ "eslint": "9.39.2",
57
+ "typescript": "5.9.3"
58
58
  }
59
59
  }
package/shared.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { fixupConfigRules } from '@eslint/compat'
2
- import { FlatCompat } from '@eslint/eslintrc'
3
1
  import path from 'node:path'
4
2
  import { fileURLToPath } from 'node:url'
3
+ import { fixupConfigRules } from '@eslint/compat'
4
+ import { FlatCompat } from '@eslint/eslintrc'
5
5
  import stylisticJs from './stylistic.mjs'
6
6
 
7
7
  const filename = fileURLToPath(import.meta.url)
@@ -11,7 +11,7 @@ const compat = new FlatCompat({
11
11
  baseDirectory: dirname,
12
12
  })
13
13
 
14
- export default [
14
+ const defaultRules = [
15
15
  ...fixupConfigRules(
16
16
  compat.extends(
17
17
  'airbnb/hooks',
@@ -24,30 +24,8 @@ export default [
24
24
  {
25
25
  rules: {
26
26
  curly: 'error',
27
- 'no-use-before-define': 'off',
28
- 'import/extensions': 'off',
29
27
  'dot-notation': 'off',
30
-
31
- 'import/order': [
32
- 'error',
33
- {
34
- alphabetize: {
35
- caseInsensitive: false,
36
- order: 'asc',
37
- },
38
-
39
- groups: [
40
- 'builtin',
41
- 'external',
42
- 'internal',
43
- 'parent',
44
- 'sibling',
45
- 'index',
46
- // "type",
47
- ],
48
- 'newlines-between': 'never',
49
- },
50
- ],
28
+ 'import/extensions': 'off',
51
29
 
52
30
  'import/no-extraneous-dependencies': [
53
31
  'error',
@@ -76,7 +54,29 @@ export default [
76
54
  },
77
55
  ],
78
56
 
57
+ 'import/order': [
58
+ 'error',
59
+ {
60
+ alphabetize: {
61
+ caseInsensitive: false,
62
+ order: 'asc',
63
+ },
64
+
65
+ groups: [
66
+ 'builtin',
67
+ 'external',
68
+ 'internal',
69
+ 'parent',
70
+ 'sibling',
71
+ 'index',
72
+ // "type",
73
+ ],
74
+ 'newlines-between': 'never',
75
+ },
76
+ ],
77
+
79
78
  'import/prefer-default-export': 'off',
79
+ 'no-constant-binary-expression': 'error',
80
80
 
81
81
  'no-restricted-syntax': [
82
82
  'error',
@@ -100,6 +100,7 @@ export default [
100
100
  selector: 'ExportAllDeclaration',
101
101
  },
102
102
  ],
103
+ 'no-use-before-define': 'off',
103
104
 
104
105
  'padding-line-between-statements': [
105
106
  'error',
@@ -109,13 +110,12 @@ export default [
109
110
  prev: '*',
110
111
  },
111
112
  ],
113
+ 'prefer-object-has-own': 'error',
112
114
 
113
115
  'react/function-component-definition': 'off',
116
+ 'react/jsx-key': 'error',
114
117
  'react/no-adjacent-inline-elements': 'error',
115
- 'prefer-object-has-own': 'error',
116
118
  'react/no-object-type-as-default-prop': 'error',
117
- 'react/static-property-placement': ['error', 'static public field'],
118
- 'react/state-in-constructor': ['error', 'never'],
119
119
 
120
120
  'react/sort-prop-types': [
121
121
  'error',
@@ -125,6 +125,8 @@ export default [
125
125
  sortShapeProp: true,
126
126
  },
127
127
  ],
128
+ 'react/state-in-constructor': ['error', 'never'],
129
+ 'react/static-property-placement': ['error', 'static public field'],
128
130
 
129
131
  'sort-imports': [
130
132
  'error',
@@ -135,8 +137,8 @@ export default [
135
137
  ],
136
138
 
137
139
  'sort-keys': 'off',
138
- 'no-constant-binary-expression': 'error',
139
- 'react/jsx-key': 'error',
140
140
  },
141
141
  },
142
142
  ]
143
+
144
+ export default defaultRules
package/stylistic.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { fixupPluginRules } from '@eslint/compat'
2
- import { FlatCompat } from '@eslint/eslintrc'
3
1
  import path from 'node:path'
4
2
  import { fileURLToPath } from 'node:url'
3
+ import { fixupPluginRules } from '@eslint/compat'
4
+ import { FlatCompat } from '@eslint/eslintrc'
5
5
  import stylisticPlugin from '@stylistic/eslint-plugin'
6
6
 
7
7
  const filename = fileURLToPath(import.meta.url)
@@ -15,40 +15,23 @@ const config = compat.extends('airbnb-base')
15
15
 
16
16
  const defaultAirBnbRules = [...fixupPluginRules(config)].reduce(
17
17
  (acc, currentConfig) => ({
18
- // biome-ignore lint/performance/noAccumulatingSpread: <explanation>
19
18
  ...acc,
20
19
  ...currentConfig.rules,
21
20
  }),
22
21
  {},
23
22
  )
24
23
 
25
- export default [
24
+ const defaultStylisticRules = [
26
25
  {
27
26
  plugins: {
28
27
  '@stylistic': stylisticPlugin,
29
28
  },
30
29
  },
31
30
  stylisticPlugin.configs['disable-legacy'],
32
- stylisticPlugin.configs['recommended-flat'],
31
+ stylisticPlugin.configs['recommended'],
33
32
  {
34
33
  rules: {
35
- // --- Should be done when using biome/prettier formatter --- //
36
- '@stylistic/quotes': 'off',
37
- '@stylistic/operator-linebreak': 'off',
38
- '@stylistic/indent': 'off',
39
- '@stylistic/quote-props': 'off',
40
- '@stylistic/indent-binary-ops': 'off',
41
34
  '@stylistic/arrow-parens': 'off',
42
- '@stylistic/multiline-ternary': 'off',
43
- '@stylistic/no-trailing-spaces': 'off',
44
- '@stylistic/comma-style': 'off',
45
- '@stylistic/func-call-spacing': 'off',
46
- '@stylistic/jsx-wrap-multilines': 'off',
47
- '@stylistic/member-delimiter-style': 'off',
48
- '@stylistic/jsx-curly-brace-presence': 'off',
49
- '@stylistic/jsx-curly-newline': 'off',
50
- '@stylistic/jsx-one-expression-per-line': 'off',
51
- '@stylistic/max-statements-per-line ': 'off',
52
35
  // -------------------------------------- ///
53
36
 
54
37
  '@stylistic/brace-style': defaultAirBnbRules['brace-style'],
@@ -62,20 +45,38 @@ export default [
62
45
  },
63
46
  ],
64
47
  '@stylistic/comma-spacing': defaultAirBnbRules['comma-spacing'],
65
- '@stylistic/func-call-spacing': defaultAirBnbRules['func-call-spacing'],
48
+ '@stylistic/comma-style': 'off',
49
+ '@stylistic/indent': 'off',
50
+ '@stylistic/indent-binary-ops': 'off',
51
+ '@stylistic/jsx-curly-brace-presence': 'off',
52
+ '@stylistic/jsx-curly-newline': 'off',
53
+ '@stylistic/jsx-one-expression-per-line': 'off',
54
+ '@stylistic/jsx-wrap-multilines': 'off',
55
+ // '@stylistic/func-call-spacing': defaultAirBnbRules['func-call-spacing'],
66
56
  '@stylistic/keyword-spacing': defaultAirBnbRules['keyword-spacing'],
57
+ '@stylistic/lines-between-class-members':
58
+ defaultAirBnbRules['lines-between-class-members'],
59
+ '@stylistic/max-statements-per-line ': 'off',
60
+ '@stylistic/member-delimiter-style': 'off',
61
+ '@stylistic/multiline-ternary': 'off',
67
62
  '@stylistic/no-extra-semi': defaultAirBnbRules['no-extra-semi'],
63
+ '@stylistic/no-trailing-spaces': 'off',
68
64
  '@stylistic/object-curly-spacing':
69
65
  defaultAirBnbRules['object-curly-spacing'],
70
- semi: 'off',
66
+ '@stylistic/operator-linebreak': 'off',
67
+ '@stylistic/quote-props': 'off',
68
+ // --- Should be done when using biome/prettier formatter --- //
69
+ '@stylistic/quotes': 'off',
71
70
  '@stylistic/semi': 'off',
72
71
  '@stylistic/space-before-blocks':
73
72
  defaultAirBnbRules['space-before-blocks'],
74
73
  '@stylistic/space-before-function-paren':
75
74
  defaultAirBnbRules['space-before-function-paren'],
76
75
  '@stylistic/space-infix-ops': defaultAirBnbRules['space-infix-ops'],
77
- '@stylistic/lines-between-class-members':
78
- defaultAirBnbRules['lines-between-class-members'],
76
+ semi: 'off',
79
77
  },
80
78
  },
81
79
  ]
80
+
81
+ export { defaultStylisticRules }
82
+ export default defaultStylisticRules
package/typescript.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { fixupConfigRules } from '@eslint/compat'
2
- import { FlatCompat } from '@eslint/eslintrc'
3
1
  import path from 'node:path'
4
2
  import { fileURLToPath } from 'node:url'
5
- import shared from './shared.mjs'
3
+ import { fixupConfigRules } from '@eslint/compat'
4
+ import { FlatCompat } from '@eslint/eslintrc'
6
5
  import airbnbTypescript from './airbnb/typescript.mjs'
6
+ import shared from './shared.mjs'
7
7
 
8
8
  const filename = fileURLToPath(import.meta.url)
9
9
  const dirname = path.dirname(filename)
@@ -12,7 +12,7 @@ const compat = new FlatCompat({
12
12
  baseDirectory: dirname,
13
13
  })
14
14
 
15
- export default [
15
+ const defaultTypescriptRules = [
16
16
  ...fixupConfigRules(
17
17
  compat.extends(
18
18
  'airbnb-base',
@@ -26,10 +26,6 @@ export default [
26
26
  ...shared,
27
27
  {
28
28
  rules: {
29
- /******* WARN ********/
30
- '@typescript-eslint/no-deprecated': 'warn',
31
- '@typescript-eslint/no-explicit-any': 'warn',
32
- '@typescript-eslint/no-redundant-type-constituents': 'warn',
33
29
  /***************************/
34
30
 
35
31
  /******* ERROR ********/
@@ -39,17 +35,13 @@ export default [
39
35
  default: 'array',
40
36
  },
41
37
  ],
38
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
39
+ '@typescript-eslint/consistent-type-exports': 'error',
40
+ '@typescript-eslint/consistent-type-imports': 'error',
42
41
  '@typescript-eslint/no-base-to-string': 'error',
43
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
44
- '@typescript-eslint/no-unnecessary-condition': 'error',
45
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
46
- '@typescript-eslint/no-unsafe-declaration-merging': 'error',
47
- '@typescript-eslint/prefer-for-of': 'error',
48
- '@typescript-eslint/prefer-includes': 'error',
49
- '@typescript-eslint/prefer-optional-chain': 'error',
50
- '@typescript-eslint/prefer-reduce-type-parameter': 'error',
51
- '@typescript-eslint/prefer-string-starts-ends-with': 'error',
52
- '@typescript-eslint/prefer-ts-expect-error': 'error',
42
+ /******* WARN ********/
43
+ '@typescript-eslint/no-deprecated': 'warn',
44
+ '@typescript-eslint/no-explicit-any': 'warn',
53
45
  '@typescript-eslint/no-floating-promises': 'error',
54
46
  '@typescript-eslint/no-misused-promises': [
55
47
  'error',
@@ -59,30 +51,30 @@ export default [
59
51
  },
60
52
  },
61
53
  ],
54
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
55
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
56
+ '@typescript-eslint/no-unnecessary-condition': 'error',
57
+ '@typescript-eslint/no-unnecessary-type-arguments': 'error',
58
+ '@typescript-eslint/no-unsafe-declaration-merging': 'error',
62
59
  '@typescript-eslint/no-unused-vars': 'error',
63
- '@typescript-eslint/consistent-type-imports': 'error',
64
- '@typescript-eslint/consistent-type-exports': 'error',
65
- '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
66
-
67
- 'react/jsx-no-useless-fragment': [
68
- 'error',
69
- {
70
- allowExpressions: true,
71
- },
72
- ],
73
-
74
- /***************************/
75
-
76
- /******* OFF ********/
77
-
78
- 'react/require-default-props': 'off',
79
- 'react/prop-types': 'off',
60
+ '@typescript-eslint/prefer-for-of': 'error',
61
+ '@typescript-eslint/prefer-includes': 'error',
62
+ '@typescript-eslint/prefer-optional-chain': 'error',
63
+ '@typescript-eslint/prefer-reduce-type-parameter': 'error',
64
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
65
+ '@typescript-eslint/prefer-ts-expect-error': 'error',
80
66
 
81
67
  // The following rules are enabled in Airbnb config, but are already checked (more thoroughly) by the TypeScript compiler
82
68
  // Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
83
69
  // Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
84
70
  'constructor-super': 'off',
85
71
  'getter-return': 'off',
72
+ // The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
73
+ // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
74
+ 'import/named': 'off',
75
+ 'import/no-named-as-default-member': 'off',
76
+ // Disable `import/no-unresolved`, see README.md for details
77
+ 'import/no-unresolved': 'off',
86
78
  'no-const-assign': 'off',
87
79
  'no-dupe-args': 'off',
88
80
  'no-dupe-class-members': 'off',
@@ -97,13 +89,24 @@ export default [
97
89
  'no-undef': 'off',
98
90
  'no-unreachable': 'off',
99
91
  'no-unsafe-negation': 'off',
92
+
93
+ 'react/jsx-no-useless-fragment': [
94
+ 'error',
95
+ {
96
+ allowExpressions: true,
97
+ },
98
+ ],
99
+ 'react/prop-types': 'off',
100
+
101
+ /***************************/
102
+
103
+ /******* OFF ********/
104
+
105
+ 'react/require-default-props': 'off',
100
106
  'valid-typeof': 'off',
101
- // The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
102
- // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
103
- 'import/named': 'off',
104
- 'import/no-named-as-default-member': 'off',
105
- // Disable `import/no-unresolved`, see README.md for details
106
- 'import/no-unresolved': 'off',
107
107
  },
108
108
  },
109
109
  ]
110
+
111
+ export { defaultTypescriptRules }
112
+ export default defaultTypescriptRules