11// @ts -check
2- import { dirname } from 'node:path' ;
3- import { fileURLToPath } from 'node:url' ;
2+ import stylisticJs from '@stylistic/eslint-plugin' ;
43
54import importPlugin from 'eslint-plugin-import' ;
65import tseslint from 'typescript-eslint' ;
76
87export default tseslint . config (
98 ...tseslint . configs . recommendedTypeChecked ,
9+ ...tseslint . configs . stylistic ,
10+ {
11+ ignores : [
12+ '.gitignore' ,
13+ 'example' ,
14+ '*.json' ,
15+ 'dist'
16+ ]
17+ } ,
1018 {
1119 languageOptions : {
12- ecmaVersion : 2022 ,
13- sourceType : 'module' ,
1420 parserOptions : {
15- project : true ,
16- tsconfigRootDir : dirname ( fileURLToPath ( import . meta. url ) ) ,
21+ project : 'tsconfig.eslint.json' ,
22+ tsconfigRootDir : import . meta. dirname ,
1723 } ,
1824 } ,
1925 plugins : {
20- import : importPlugin ,
26+ import : importPlugin ,
27+ '@style' : stylisticJs ,
2128 } ,
2229 rules : {
23- '@typescript-eslint/ban-ts-ignore' : 'off' ,
24- '@typescript-eslint/explicit-function-return-type' : [ 'error' ] ,
25- '@typescript-eslint/explicit-module-boundary-types' : [ 'error' ] ,
26- '@typescript-eslint/indent' : [ 'error' , 2 , {
27- ArrayExpression : 'first' ,
30+ '@style/indent' : [ 'error' , 2 , {
31+ ArrayExpression : 'first' ,
2832 FunctionDeclaration : {
2933 parameters : 'first'
3034 } ,
31- ImportDeclaration : 1 ,
32- ObjectExpression : 1 ,
33- SwitchCase : 1 ,
35+ ImportDeclaration : 1 ,
36+ ObjectExpression : 1 ,
37+ SwitchCase : 1 ,
3438 VariableDeclarator : 'first'
35- } ] ,
36- '@typescript-eslint/no-unsafe-argument' : 'off' ,
37- '@typescript-eslint/no-unsafe-call' : 'off' ,
38- '@typescript-eslint/no-unsafe-return' : 'off' ,
39+ } ] ,
40+ '@style/no-extra-parens' : [ 'error' ] ,
41+ '@style/type-annotation-spacing' : 'error' ,
42+ '@typescript-eslint/ban-ts-ignore' : 'off' ,
43+ '@typescript-eslint/explicit-function-return-type' : [ 'error' ] ,
44+ '@typescript-eslint/explicit-module-boundary-types' : [ 'error' ] ,
45+ '@typescript-eslint/interface-name-prefix' : 'off' ,
46+ '@typescript-eslint/no-explicit-any' : 'off' ,
3947 '@typescript-eslint/no-redundant-type-constituents' : 'off' ,
40- '@typescript-eslint/no-unsafe-assignment' : 'off' ,
41- '@typescript-eslint/no-unsafe-member-access' : 'off' ,
42- '@typescript-eslint/interface-name-prefix' : 'off' ,
43- '@typescript-eslint/no-explicit-any' : 'off' ,
44- '@typescript-eslint/no-extra-parens' : [ 'error' ] ,
48+ '@typescript-eslint/no-unsafe-argument' : 'off' ,
49+ '@typescript-eslint/no-unsafe-assignment' : 'off' ,
50+ '@typescript-eslint/no-unsafe-call' : 'off' ,
51+ '@typescript-eslint/no-unsafe-member-access' : 'off' ,
52+ '@typescript-eslint/no-unsafe-return' : 'off' ,
53+ '@typescript-eslint/prefer-promise-reject-errors' : 'off' ,
4554 '@typescript-eslint/prefer-string-starts-ends-with' : 'error' ,
46- '@typescript-eslint/type-annotation- spacing' : 'error' ,
47- 'array-bracket- spacing' : 'error' ,
48- 'comma- spacing' : [ 2 , { before : false , after : true } ] ,
49- 'computed-property-spacing ' : [ 'error' , 'never' , { enforceForClassMembers : true } ] ,
50- 'import/first' : 'error' ,
51- 'import/no-useless-path-segments' : [
55+ 'array-bracket- spacing' : 'error' ,
56+ 'comma- spacing' : [ 2 , { before : false , after : true } ] ,
57+ 'computed-property- spacing' : [ 'error' , 'never' , { enforceForClassMembers : true } ] ,
58+ 'import/first ' : 'error' ,
59+ 'import/no-duplicates' : 'error' ,
60+ 'import/no-useless-path-segments' : [
5261 'error' ,
5362 {
5463 noUselessIndex : true
@@ -58,44 +67,43 @@ export default tseslint.config(
5867 'error' ,
5968 {
6069 'newlines-between' : 'always-and-inside-groups' ,
61- 'alphabetize' : {
62- order : 'asc' ,
70+ 'alphabetize' : {
71+ order : 'asc' ,
6372 caseInsensitive : true
6473 } ,
6574 'pathGroups' : [
6675 {
6776 pattern : '~/**' ,
68- group : 'external'
77+ group : 'external'
6978 }
7079 ]
7180 }
7281 ] ,
73- 'indent' : 'off' ,
74- 'key-spacing' : [ 'error' , { align : 'value' } ] ,
75- 'keyword-spacing' : [ 'error' ] ,
82+ 'indent' : 'off' ,
83+ 'key-spacing' : [ 'error' , { align : 'value' } ] ,
84+ 'keyword-spacing' : [ 'error' ] ,
7685 'linebreak-style' : [
7786 'error' ,
7887 'unix'
7988 ] ,
80- 'lines-between-class-members' : [ 'error' , 'always' ] ,
81- 'no-debugger' : 'error' ,
82- 'no-extra-parens' : 'off' ,
83- 'no-mixed-spaces-and-tabs' : 'error' ,
84- 'no-multi-spaces' : [ 'error' , { exceptions : { VariableDeclarator : true } } ] ,
85- 'no-var' : 'error' ,
86- 'import/no-duplicates' : 'error' ,
89+ 'lines-between-class-members' : [ 'error' , 'always' ] ,
90+ 'no-debugger' : 'error' ,
91+ 'no-extra-parens' : 'off' ,
92+ 'no-mixed-spaces-and-tabs' : 'error' ,
93+ 'no-multi-spaces' : [ 'error' , { exceptions : { VariableDeclarator : true } } ] ,
94+ 'no-var' : 'error' ,
8795 'no-whitespace-before-property' : 'error' ,
88- 'object-curly-spacing' : [
96+ 'object-curly-spacing' : [
8997 'error' ,
9098 'always' ,
9199 {
92- arraysInObjects : true ,
100+ arraysInObjects : true ,
93101 objectsInObjects : true
94102 }
95103 ] ,
96- 'padded-blocks' : [ 'error' , 'never' ] ,
104+ 'padded-blocks' : [ 'error' , 'never' ] ,
97105 'prefer-template' : 'error' ,
98- 'quotes' : [
106+ 'quotes' : [
99107 'error' ,
100108 'single' ,
101109 {
@@ -105,13 +113,13 @@ export default tseslint.config(
105113 'space-before-function-paren' : [
106114 'error' ,
107115 {
108- anonymous : 'always' ,
116+ anonymous : 'always' ,
109117 asyncArrow : 'always' ,
110- named : 'never'
118+ named : 'never'
111119 }
112120 ] ,
113- 'space-in-parens' : [ 'error' , 'always' ] ,
114- 'template-curly-spacing' : [ 'error' , 'always' ]
121+ 'space-in-parens' : [ 'error' , 'always' ] ,
122+ 'template-curly-spacing' : [ 'error' , 'always' ]
115123 }
116124 }
117125) ;
0 commit comments