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,98 @@ 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+ 'type' : 'natural'
204+ }
205+ ] ,
206+ 'perfectionist/sort-interfaces' : [
207+ 'error' ,
208+ {
209+ 'customGroups' : [
210+ {
211+ 'elementNamePattern' : '^on.+' ,
212+ 'groupName' : 'callback'
213+ }
214+ ] ,
215+ 'groups' : [
216+ 'unknown' ,
217+ 'method' ,
218+ 'callback'
219+ ] ,
220+ 'newlinesBetween' : 'ignore' ,
221+ 'newlinesInside' : 'ignore' ,
222+ 'partitionByNewLine' : true ,
223+ 'type' : 'natural'
224+ }
225+ ] ,
226+ 'perfectionist/sort-jsx-props' : [
227+ 'error' ,
228+ {
229+ 'customGroups' : [
230+ {
231+ 'elementNamePattern' : '^on.+' ,
232+ 'groupName' : 'callback'
233+ }
234+ ] ,
235+ 'groups' : [
236+ 'shorthand-prop' ,
237+ 'unknown' ,
238+ 'multiline-prop' ,
239+ 'callback'
240+ ] ,
241+ 'newlinesBetween' : 'ignore' ,
242+ 'newlinesInside' : 'ignore' ,
243+ 'partitionByNewLine' : true ,
244+ 'type' : 'natural'
245+ }
246+ ] ,
247+ 'perfectionist/sort-objects' : [
248+ 'error' ,
249+ {
250+ 'customGroups' : [
251+ {
252+ 'elementNamePattern' : '^on.+' ,
253+ 'groupName' : 'callback'
254+ }
255+ ] ,
256+ 'groups' : [
257+ 'unknown' ,
258+ 'method' ,
259+ 'callback'
260+ ] ,
261+ 'newlinesBetween' : 'ignore' ,
262+ 'newlinesInside' : 'ignore' ,
263+ 'partitionByNewLine' : true ,
264+ 'type' : 'natural'
265+ }
266+ ] ,
211267 'react/no-unknown-property' : [
212268 'error' ,
213269 {
@@ -217,10 +273,19 @@ export default defineConfig(
217273 }
218274 ] ,
219275 'sonarjs/no-empty-function' : 'off' ,
276+ 'sonarjs/no-small-switch' : 'off' ,
220277 'sonarjs/no-unknown-property' : 'off' ,
221278 'sonarjs/no-unused-expressions' : 'off' ,
222279 'sonarjs/no-unused-vars' : 'off' ,
223- 'sonarjs/prefer-single-boolean-return' : 'off'
280+ 'sonarjs/prefer-single-boolean-return' : 'off' ,
281+ 'space-before-function-paren' : [
282+ 'error' ,
283+ {
284+ 'anonymous' : 'never' ,
285+ 'asyncArrow' : 'always' ,
286+ 'named' : 'never'
287+ }
288+ ]
224289 }
225290 }
226291) ;
0 commit comments