@@ -5,65 +5,59 @@ const IS_TS_PROJECT = fs.existsSync(
55 path . join ( process . cwd ( ) || '.' , './tsconfig.json' )
66)
77
8- const parser = IS_TS_PROJECT
9- ? '@typescript-eslint/parser'
10- : '@babel/eslint-parser'
11-
12- const _extends = ( ( ) => {
13- return [
14- 'eslint:recommended' ,
15- IS_TS_PROJECT ? 'plugin:@typescript-eslint/recommended' : null ,
16- 'plugin:import/errors' ,
17- 'plugin:import/warnings' ,
18- 'plugin:import/typescript' ,
19- 'plugin:jsx-a11y/recommended' ,
20- 'plugin:react/recommended' ,
21- 'plugin:react-hooks/recommended' ,
22- 'plugin:prettier/recommended' ,
23- ] . filter ( ( ext ) => ext && typeof ext === 'string' )
24- } ) ( )
25-
26- const rules = {
27- 'simple-import-sort/imports' : 1 ,
28- 'simple-import-sort/exports' : 1 ,
29- 'sort-imports' : 0 ,
30- 'import/order' : 0 ,
31- 'react/jsx-sort-props' : [
32- 2 ,
33- {
34- callbacksLast : true ,
35- shorthandFirst : true ,
36- shorthandLast : false ,
37- ignoreCase : false ,
38- noSortAlphabetically : false ,
39- reservedFirst : true ,
40- } ,
41- ] ,
42- ...( IS_TS_PROJECT
43- ? {
44- '@typescript-eslint/no-var-requires' : 0 ,
45- '@typescript-eslint/no-non-null-assertion' : 0 ,
46- '@typescript-eslint/no-use-before-define' : 2 ,
47- '@typescript-eslint/explicit-module-boundary-types' : 0 ,
48- '@typescript-eslint/consistent-type-imports' : [
49- 2 ,
50- {
51- prefer : 'type-imports' ,
52- disallowTypeAnnotations : true ,
53- } ,
54- ] ,
55- }
56- : { } ) ,
57- }
58-
598module . exports = {
609 env : {
6110 node : true ,
6211 browser : true ,
6312 es6 : true ,
6413 } ,
65- parser,
66- extends : _extends ,
14+ parser : IS_TS_PROJECT ? '@typescript-eslint/parser' : '@babel/eslint-parser' ,
15+ extends : ( ( ) =>
16+ [
17+ 'eslint:recommended' ,
18+ IS_TS_PROJECT ? 'plugin:@typescript-eslint/recommended' : null ,
19+ 'plugin:import/errors' ,
20+ 'plugin:import/warnings' ,
21+ 'plugin:import/typescript' ,
22+ 'plugin:jsx-a11y/recommended' ,
23+ 'plugin:react/recommended' ,
24+ 'plugin:react-hooks/recommended' ,
25+ 'plugin:prettier/recommended' ,
26+ ] . filter ( ( ext ) => ext && typeof ext === 'string' )
27+ ) ( ) ,
6728 plugins : [ 'simple-import-sort' ] ,
68- rules,
29+ rules : {
30+ 'simple-import-sort/imports' : 1 ,
31+ 'simple-import-sort/exports' : 1 ,
32+ 'sort-imports' : 0 ,
33+ 'import/order' : 0 ,
34+ 'react/jsx-sort-props' : [
35+ 2 ,
36+ {
37+ callbacksLast : true ,
38+ shorthandFirst : true ,
39+ shorthandLast : false ,
40+ ignoreCase : false ,
41+ noSortAlphabetically : false ,
42+ reservedFirst : true ,
43+ } ,
44+ ] ,
45+ 'func-style' : [ 2 , 'declaration' , { allowArrowFunctions : true } ] ,
46+
47+ ...( IS_TS_PROJECT
48+ ? {
49+ '@typescript-eslint/no-var-requires' : 0 ,
50+ '@typescript-eslint/no-non-null-assertion' : 0 ,
51+ '@typescript-eslint/no-use-before-define' : 2 ,
52+ '@typescript-eslint/explicit-module-boundary-types' : 0 ,
53+ '@typescript-eslint/consistent-type-imports' : [
54+ 2 ,
55+ {
56+ prefer : 'type-imports' ,
57+ disallowTypeAnnotations : true ,
58+ } ,
59+ ] ,
60+ }
61+ : { } ) ,
62+ } ,
6963}
0 commit comments