Skip to content

Commit e5393ad

Browse files
committed
feat(eslint-config): migrate to stylistic plugin
1 parent a56fc43 commit e5393ad

File tree

6 files changed

+123
-105
lines changed

6 files changed

+123
-105
lines changed

packages/eslint-config/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
},
5555
"dependencies": {
5656
"@eslint/js": "^9.12.0",
57+
"@stylistic/eslint-plugin": "^5.1.0",
5758
"@typescript-eslint/eslint-plugin": "^8.0.0",
5859
"@typescript-eslint/parser": "^8.0.0",
5960
"eslint-plugin-import": "^2.30.0",

packages/eslint-config/src/subconfigs/basic.js

Lines changed: 61 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
* Basic config
33
*/
44

5+
import stylisticPlugin from '@stylistic/eslint-plugin'
6+
57
export default [
68
{
9+
plugins: {
10+
'@stylistic': stylisticPlugin
11+
},
712
rules: {
813
// Possible Errors
914
'no-console': [
@@ -17,7 +22,7 @@ export default [
1722
}
1823
],
1924
'no-debugger': 'warn',
20-
'no-extra-parens': [
25+
'@stylistic/no-extra-parens': [
2126
'error',
2227
'all',
2328
{
@@ -44,7 +49,7 @@ export default [
4449
'consistent-return': 'error',
4550
'curly': 'error',
4651
'default-case-last': 'error',
47-
'dot-location': ['error', 'property'],
52+
'@stylistic/dot-location': ['error', 'property'],
4853
'dot-notation': 'error',
4954
'eqeqeq': 'error',
5055
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
@@ -72,7 +77,7 @@ export default [
7277
ignore: [
7378
-1,
7479
0,
75-
.5,
80+
0.5,
7681
1,
7782
2,
7883
100
@@ -81,7 +86,7 @@ export default [
8186
detectObjects: false
8287
}
8388
],
84-
'no-multi-spaces': 'error',
89+
'@stylistic/no-multi-spaces': 'error',
8590
'no-multi-str': 'error',
8691
'no-new': 'error',
8792
'no-new-func': 'error',
@@ -135,30 +140,30 @@ export default [
135140
],
136141

137142
// Stylistic Issues
138-
'array-bracket-newline': [
143+
'@stylistic/array-bracket-newline': [
139144
'error',
140145
{
141146
multiline: true
142147
}
143148
],
144-
'array-bracket-spacing': ['error', 'never'],
145-
'array-element-newline': [
149+
'@stylistic/array-bracket-spacing': ['error', 'never'],
150+
'@stylistic/array-element-newline': [
146151
'error',
147152
{
148153
multiline: true,
149154
minItems: 3
150155
}
151156
],
152-
'block-spacing': 'error',
153-
'brace-style': ['error', '1tbs'],
157+
'@stylistic/block-spacing': 'error',
158+
'@stylistic/brace-style': ['error', '1tbs'],
154159
'camelcase': 'error',
155-
'comma-dangle': ['error', 'never'],
156-
'comma-spacing': 'error',
157-
'comma-style': 'error',
158-
'computed-property-spacing': 'error',
160+
'@stylistic/comma-dangle': ['error', 'never'],
161+
'@stylistic/comma-spacing': 'error',
162+
'@stylistic/comma-style': 'error',
163+
'@stylistic/computed-property-spacing': 'error',
159164
'consistent-this': ['error', 'self'],
160-
'eol-last': 'error',
161-
'func-call-spacing': 'error',
165+
'@stylistic/eol-last': 'error',
166+
'@stylistic/function-call-spacing': 'error',
162167
'func-names': 'error',
163168
'func-style': [
164169
'error',
@@ -167,26 +172,28 @@ export default [
167172
allowArrowFunctions: true
168173
}
169174
],
170-
'function-call-argument-newline': ['error', 'consistent'],
171-
'function-paren-newline': ['error', 'consistent'],
172-
'implicit-arrow-linebreak': ['error', 'beside'],
173-
'indent': [
175+
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
176+
'@stylistic/function-paren-newline': ['error', 'consistent'],
177+
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
178+
'@stylistic/indent': [
174179
'error',
175180
2,
176181
{
182+
ignoredNodes: ['TSTypeParameterInstantiation', 'TSIntersectionType'],
177183
SwitchCase: 1
178184
}
179185
],
180-
'jsx-quotes': ['error', 'prefer-single'],
181-
'key-spacing': [
186+
'@stylistic/indent-binary-ops': ['error', 2],
187+
'@stylistic/jsx-quotes': ['error', 'prefer-single'],
188+
'@stylistic/key-spacing': [
182189
'error',
183190
{
184191
mode: 'strict'
185192
}
186193
],
187-
'keyword-spacing': 'error',
188-
'linebreak-style': 'error',
189-
'lines-between-class-members': [
194+
'@stylistic/keyword-spacing': 'error',
195+
'@stylistic/linebreak-style': 'error',
196+
'@stylistic/lines-between-class-members': [
190197
'error',
191198
'always',
192199
{
@@ -195,28 +202,29 @@ export default [
195202
],
196203
'max-nested-callbacks': ['error', 4],
197204
'max-params': ['error', 6],
198-
'max-statements-per-line': 'error',
205+
'@stylistic/max-statements-per-line': 'error',
199206
'new-cap': [
200207
'error',
201208
{
202209
capIsNew: false
203210
}
204211
],
205-
'new-parens': 'error',
212+
'@stylistic/new-parens': 'error',
206213
'no-array-constructor': 'error',
207214
'no-lonely-if': 'error',
208215
'no-multi-assign': 'error',
209-
'no-multiple-empty-lines': [
216+
'@stylistic/no-multiple-empty-lines': [
210217
'error',
211218
{
212219
max: 1
213220
}
214221
],
215222
'no-new-object': 'error',
216-
'no-trailing-spaces': 'error',
223+
'@stylistic/no-trailing-spaces': 'error',
217224
'no-unneeded-ternary': 'error',
218-
'no-whitespace-before-property': 'error',
219-
'object-curly-newline': [
225+
'@stylistic/no-whitespace-before-property': 'error',
226+
'@stylistic/curly-newline': ['error', 'always'],
227+
'@stylistic/object-curly-newline': [
220228
'error',
221229
{
222230
ObjectExpression: {
@@ -233,17 +241,17 @@ export default [
233241
}
234242
}
235243
],
236-
'object-curly-spacing': ['error', 'always'],
237-
'object-property-newline': [
244+
'@stylistic/object-curly-spacing': ['error', 'always'],
245+
'@stylistic/object-property-newline': [
238246
'error',
239247
{
240248
allowAllPropertiesOnSameLine: false
241249
}
242250
],
243251
'one-var': ['error', 'never'],
244-
'one-var-declaration-per-line': ['error', 'initializations'],
252+
'@stylistic/one-var-declaration-per-line': ['error', 'initializations'],
245253
'operator-assignment': ['error', 'always'],
246-
'operator-linebreak': [
254+
'@stylistic/operator-linebreak': [
247255
'error',
248256
'before',
249257
{
@@ -252,8 +260,8 @@ export default [
252260
}
253261
}
254262
],
255-
'padded-blocks': ['error', 'never'],
256-
'padding-line-between-statements': [
263+
'@stylistic/padded-blocks': ['error', 'never'],
264+
'@stylistic/padding-line-between-statements': [
257265
'error',
258266
{
259267
blankLine: 'always',
@@ -302,36 +310,42 @@ export default [
302310
}
303311
],
304312
'prefer-object-spread': 'error',
305-
'quote-props': ['error', 'consistent-as-needed'],
306-
'quotes': [
313+
'@stylistic/quote-props': ['error', 'consistent-as-needed'],
314+
'@stylistic/quotes': [
307315
'error',
308316
'single',
309317
{
310318
avoidEscape: true,
311319
allowTemplateLiterals: true
312320
}
313321
],
314-
'semi': ['error', 'never'],
315-
'space-before-blocks': 'error',
316-
'space-before-function-paren': [
322+
'@stylistic/semi': ['error', 'never'],
323+
'@stylistic/space-before-blocks': 'error',
324+
'@stylistic/space-before-function-paren': [
317325
'error',
318326
{
319327
anonymous: 'always',
320328
named: 'never',
321329
asyncArrow: 'always'
322330
}
323331
],
324-
'space-in-parens': 'error',
325-
'space-infix-ops': [
332+
'@stylistic/space-in-parens': 'error',
333+
'@stylistic/space-infix-ops': [
326334
'error',
327335
{
328336
int32Hint: true
329337
}
330338
],
331-
'space-unary-ops': 'error',
332-
'spaced-comment': 'error',
333-
'switch-colon-spacing': 'error',
334-
'template-tag-spacing': 'error',
339+
'@stylistic/space-unary-ops': 'error',
340+
'@stylistic/spaced-comment': 'error',
341+
'@stylistic/switch-colon-spacing': 'error',
342+
'@stylistic/template-tag-spacing': 'error',
343+
'@stylistic/no-floating-decimal': 'error',
344+
'@stylistic/no-extra-semi': 'error',
345+
'@stylistic/semi-spacing': 'error',
346+
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
347+
'@stylistic/no-tabs': 'error',
348+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
335349
'unicode-bom': 'error'
336350
}
337351
}

packages/eslint-config/src/subconfigs/es6.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
*/
44

55
import importPlugin from 'eslint-plugin-import'
6+
import stylisticPlugin from '@stylistic/eslint-plugin'
67

78
export default [
89
{
910
plugins: {
10-
import: importPlugin
11+
'import': importPlugin,
12+
'@stylistic': stylisticPlugin
1113
},
1214
rules: {
1315
// Import
@@ -68,16 +70,16 @@ export default [
6870

6971
// Other
7072
'arrow-body-style': ['error', 'as-needed'],
71-
'arrow-parens': [
73+
'@stylistic/arrow-parens': [
7274
'error',
7375
'as-needed',
7476
{
7577
requireForBlockBody: true
7678
}
7779
],
78-
'arrow-spacing': 'error',
79-
'generator-star-spacing': ['error', 'after'],
80-
'no-confusing-arrow': [
80+
'@stylistic/arrow-spacing': 'error',
81+
'@stylistic/generator-star-spacing': ['error', 'after'],
82+
'@stylistic/no-confusing-arrow': [
8183
'error',
8284
{
8385
allowParens: true
@@ -107,10 +109,10 @@ export default [
107109
'prefer-rest-params': 'error',
108110
'prefer-spread': 'error',
109111
'prefer-template': 'error',
110-
'rest-spread-spacing': ['error', 'never'],
112+
'@stylistic/rest-spread-spacing': ['error', 'never'],
111113
'symbol-description': 'error',
112-
'template-curly-spacing': 'error',
113-
'yield-star-spacing': ['error', 'after']
114+
'@stylistic/template-curly-spacing': 'error',
115+
'@stylistic/yield-star-spacing': ['error', 'after']
114116
}
115117
}
116118
]

0 commit comments

Comments
 (0)