66// https://github.com/karamem0/commistant/blob/main/LICENSE
77//
88
9- import { defineConfig } from 'eslint/config' ;
10- import globals from 'globals' ;
11- import hooks from 'eslint-plugin-hooks' ;
129import js from '@eslint/js' ;
10+ import stylistic from '@stylistic/eslint-plugin' ;
11+ import hooks from 'eslint-plugin-hooks' ;
1312import jsxA11y from 'eslint-plugin-jsx-a11y' ;
13+ import perfectionist from 'eslint-plugin-perfectionist' ;
1414import react from 'eslint-plugin-react' ;
1515import reactHooks from 'eslint-plugin-react-hooks' ;
1616import sonarjs from 'eslint-plugin-sonarjs' ;
17- import stylistic from '@stylistic/eslint-plugin' ;
17+ import { defineConfig } from 'eslint/config' ;
18+ import globals from 'globals' ;
1819import ts from 'typescript-eslint' ;
1920
2021export default defineConfig (
@@ -31,6 +32,7 @@ export default defineConfig(
3132 '@stylistic' : stylistic ,
3233 'hooks' : hooks ,
3334 'jsx-a11y' : jsxA11y ,
35+ 'perfectionist' : perfectionist ,
3436 'react' : react ,
3537 'react-hooks' : reactHooks ,
3638 'sonarjs' : sonarjs
@@ -46,60 +48,18 @@ export default defineConfig(
4648 'rules' : {
4749 ...reactHooks . configs . recommended . rules ,
4850 ...sonarjs . configs . recommended . rules ,
49- 'dot-notation' : [
50- 'error' ,
51- {
52- 'allowPattern' : '^[a-z]+(_[a-z]+)+$'
53- }
54- ] ,
55- 'key-spacing' : [
56- 'error' ,
57- {
58- 'afterColon' : true
59- }
60- ] ,
61- 'linebreak-style' : [
62- 'error' ,
63- 'unix'
64- ] ,
65- 'no-alert' : 'error' ,
66- 'no-console' : [
67- 'warn' ,
68- {
69- 'allow' : [
70- 'error'
71- ]
72- }
73- ] ,
74- 'no-unused-vars' : 'off' ,
75- 'no-use-before-define' : 'off' ,
76- 'no-var' : 'error' ,
77- 'sort-imports' : [
78- 'error' ,
79- {
80- 'allowSeparatedGroups' : true
81- }
82- ] ,
83- 'space-before-function-paren' : [
51+ '@stylistic/array-bracket-spacing' : [
8452 'error' ,
53+ 'always' ,
8554 {
86- 'anonymous' : 'never' ,
87- 'named' : 'never' ,
88- 'asyncArrow' : 'always'
55+ 'arraysInArrays' : false
8956 }
9057 ] ,
9158 '@stylistic/arrow-parens' : [
9259 'error' ,
9360 'always'
9461 ] ,
9562 '@stylistic/arrow-spacing' : 'error' ,
96- '@stylistic/array-bracket-spacing' : [
97- 'error' ,
98- 'always' ,
99- {
100- 'arraysInArrays' : false
101- }
102- ] ,
10363 '@stylistic/brace-style' : [
10464 'error' ,
10565 '1tbs'
@@ -134,14 +94,6 @@ export default defineConfig(
13494 'maximum' : 1
13595 }
13696 ] ,
137- '@stylistic/jsx-sort-props' : [
138- 'error' ,
139- {
140- 'callbacksLast' : true ,
141- 'multiline' : 'last' ,
142- 'reservedFirst' : true
143- }
144- ] ,
14597 '@stylistic/jsx-tag-spacing' : [
14698 'error' ,
14799 {
@@ -167,17 +119,23 @@ export default defineConfig(
167119 ] ,
168120 '@stylistic/operator-linebreak' : [
169121 'error' ,
170- 'after'
122+ 'after' ,
123+ {
124+ 'overrides' : {
125+ '&' : 'before' ,
126+ '|' : 'before'
127+ }
128+ }
171129 ] ,
172130 '@stylistic/padded-blocks' : 'off' ,
173- '@stylistic/quotes' : [
174- 'error' ,
175- 'single'
176- ] ,
177131 '@stylistic/quote-props' : [
178132 'error' ,
179133 'consistent'
180134 ] ,
135+ '@stylistic/quotes' : [
136+ 'error' ,
137+ 'single'
138+ ] ,
181139 '@stylistic/semi' : [
182140 'error' ,
183141 'always'
@@ -194,6 +152,12 @@ export default defineConfig(
194152 'varsIgnorePattern' : '^_'
195153 }
196154 ] ,
155+ 'dot-notation' : [
156+ 'error' ,
157+ {
158+ 'allowPattern' : '^[a-z]+(_[a-z]+)+$'
159+ }
160+ ] ,
197161 'hooks/sort' : [
198162 'error' ,
199163 {
@@ -208,6 +172,94 @@ export default defineConfig(
208172 ]
209173 }
210174 ] ,
175+ 'key-spacing' : [
176+ 'error' ,
177+ {
178+ 'afterColon' : true
179+ }
180+ ] ,
181+ 'linebreak-style' : [
182+ 'error' ,
183+ 'unix'
184+ ] ,
185+ 'no-alert' : 'error' ,
186+ 'no-console' : [
187+ 'warn' ,
188+ {
189+ 'allow' : [
190+ 'error'
191+ ]
192+ }
193+ ] ,
194+ 'no-unused-vars' : 'off' ,
195+ 'no-use-before-define' : 'off' ,
196+ 'no-var' : 'error' ,
197+ 'perfectionist/sort-imports' : [
198+ 'error' ,
199+ {
200+ 'newlinesBetween' : 'ignore' ,
201+ 'newlinesInside' : 'ignore' ,
202+ 'partitionByNewLine' : true
203+ }
204+ ] ,
205+ 'perfectionist/sort-interfaces' : [
206+ 'error' ,
207+ {
208+ 'customGroups' : [
209+ {
210+ 'elementNamePattern' : '^on.+' ,
211+ 'groupName' : 'callback'
212+ }
213+ ] ,
214+ 'groups' : [
215+ 'unknown' ,
216+ 'method' ,
217+ 'callback'
218+ ] ,
219+ 'newlinesBetween' : 'ignore' ,
220+ 'newlinesInside' : 'ignore' ,
221+ 'partitionByNewLine' : true
222+ }
223+ ] ,
224+ 'perfectionist/sort-jsx-props' : [
225+ 'error' ,
226+ {
227+ 'customGroups' : [
228+ {
229+ 'elementNamePattern' : '^on.+' ,
230+ 'groupName' : 'callback'
231+ }
232+ ] ,
233+ 'groups' : [
234+ 'shorthand-prop' ,
235+ 'unknown' ,
236+ 'multiline-prop' ,
237+ 'callback'
238+ ] ,
239+ 'newlinesBetween' : 'ignore' ,
240+ 'newlinesInside' : 'ignore' ,
241+ 'partitionByNewLine' : true
242+ }
243+ ] ,
244+ 'perfectionist/sort-objects' : [
245+ 'error' ,
246+ {
247+ 'customGroups' : [
248+ {
249+ 'elementNamePattern' : '^on.+' ,
250+ 'groupName' : 'callback'
251+ }
252+ ] ,
253+ 'groups' : [
254+ 'unknown' ,
255+ 'method' ,
256+ 'callback'
257+ ] ,
258+ 'newlinesBetween' : 'ignore' ,
259+ 'newlinesInside' : 'ignore' ,
260+ 'partitionByNewLine' : true
261+ }
262+ ] ,
211263 'react/no-unknown-property' : [
212264 'error' ,
213265 {
@@ -217,10 +269,19 @@ export default defineConfig(
217269 }
218270 ] ,
219271 'sonarjs/no-empty-function' : 'off' ,
272+ 'sonarjs/no-small-switch' : 'off' ,
220273 'sonarjs/no-unknown-property' : 'off' ,
221274 'sonarjs/no-unused-expressions' : 'off' ,
222275 'sonarjs/no-unused-vars' : 'off' ,
223- 'sonarjs/prefer-single-boolean-return' : 'off'
276+ 'sonarjs/prefer-single-boolean-return' : 'off' ,
277+ 'space-before-function-paren' : [
278+ 'error' ,
279+ {
280+ 'anonymous' : 'never' ,
281+ 'asyncArrow' : 'always' ,
282+ 'named' : 'never'
283+ }
284+ ]
224285 }
225286 }
226287) ;
0 commit comments