66// https://github.com/karamem0/commistant/blob/main/LICENSE
77//
88
9- import { FlatCompat } from '@eslint/eslintrc' ;
10- import { fileURLToPath } from 'url' ;
11- import { fixupConfigRules } from '@eslint/compat' ;
129import globals from 'globals' ;
10+ import hooks from 'eslint-plugin-hooks' ;
1311import js from '@eslint/js' ;
14- import path from 'path' ;
15- import pluginHooks from 'eslint-plugin-hooks' ;
12+ import jsxA11y from 'eslint-plugin-jsx-a11y' ;
13+ import react from 'eslint-plugin-react' ;
14+ import reactHooks from 'eslint-plugin-react-hooks' ;
15+ import sonarjs from 'eslint-plugin-sonarjs' ;
16+ import stylistic from '@stylistic/eslint-plugin' ;
17+ import ts from 'typescript-eslint' ;
1618
17- const compat = new FlatCompat ( {
18- baseDirectory : path . dirname ( fileURLToPath ( import . meta. url ) ) ,
19- recommendedConfig : js . configs . recommended ,
20- allConfig : js . configs . all
21- } ) ;
22-
23- export default [
19+ export default ts . config (
20+ js . configs . recommended ,
21+ ts . configs . recommended ,
2422 {
2523 'languageOptions' : {
2624 'globals' : {
2725 ...globals . browser ,
28- ...globals . jest
26+ ...globals . jest ,
27+ ...globals . node
2928 }
3029 } ,
3130 'plugins' : {
32- 'hooks' : pluginHooks
31+ '@stylistic' : stylistic ,
32+ 'hooks' : hooks ,
33+ 'jsx-a11y' : jsxA11y ,
34+ 'react' : react ,
35+ 'react-hooks' : reactHooks ,
36+ 'sonarjs' : sonarjs
3337 } ,
3438 'settings' : {
39+ ...sonarjs . configs . recommended . settings ,
3540 'react' : {
3641 'version' : 'detect'
3742 }
3843 }
3944 } ,
40- ...fixupConfigRules ( compat . extends (
41- 'plugin:@stylistic/recommended-extends' ,
42- 'plugin:@typescript-eslint/recommended' ,
43- 'plugin:jsx-a11y/recommended' ,
44- 'plugin:react/recommended' ,
45- 'plugin:react-hooks/recommended' ,
46- 'plugin:sonarjs/recommended-legacy'
47- ) ) ,
4845 {
4946 'rules' : {
47+ ...reactHooks . configs . recommended . rules ,
48+ ...sonarjs . configs . recommended . rules ,
5049 'dot-notation' : [
5150 'error' ,
5251 {
@@ -115,7 +114,7 @@ export default [
115114 ] ,
116115 '@stylistic/indent-binary-ops' : [
117116 'error' ,
118- 4
117+ 2
119118 ] ,
120119 '@stylistic/jsx-closing-bracket-location' : [
121120 'error' ,
@@ -195,7 +194,6 @@ export default [
195194 'varsIgnorePattern' : '^_'
196195 }
197196 ] ,
198- '@typescript-eslint/no-use-before-define' : 'error' ,
199197 'hooks/sort' : [
200198 'error' ,
201199 {
@@ -218,14 +216,11 @@ export default [
218216 ]
219217 }
220218 ] ,
221- 'react/prop-types' : 'off' ,
222- 'sonarjs/max-switch-cases' : 'warn' ,
223- 'sonarjs/no-collapsible-if' : 'warn' ,
224- 'sonarjs/no-duplicate-string' : 'off' ,
225- 'sonarjs/no-small-switch' : 'warn' ,
219+ 'sonarjs/no-empty-function' : 'off' ,
226220 'sonarjs/no-unknown-property' : 'off' ,
227- 'sonarjs/prefer-single-boolean-return' : 'off' ,
228- 'sonarjs/sonar-no-unused-vars' : 'off'
221+ 'sonarjs/no-unused-expressions' : 'off' ,
222+ 'sonarjs/no-unused-vars' : 'off' ,
223+ 'sonarjs/prefer-single-boolean-return' : 'off'
229224 }
230225 }
231- ] ;
226+ ) ;
0 commit comments