11import jsDocConfig from "eslint-plugin-jsdoc" ;
2+ import tsConfig , { type Config } from "typescript-eslint" ;
23import tsDocConfig from "eslint-plugin-tsdoc" ;
34import globals from "globals" ;
45import unusedImports from "eslint-plugin-unused-imports" ;
@@ -16,83 +17,104 @@ const languageOptions: Linter.Config["languageOptions"] = {
1617 ...globals . es2021
1718 }
1819} ;
19- export const tsConfigs : Linter . Config = {
20- plugins : {
21- jsdoc : jsDocConfig ,
22- tsdoc : tsDocConfig ,
23- "unused-imports" : unusedImports
20+ export const tsConfigs : Config = [
21+ ...tsConfig . configs . recommended ,
22+ {
23+ ignores : [ "dist" , "node_modules" ]
2424 } ,
25- languageOptions,
26- rules : {
27- "array-bracket-newline" : [ "error" , "consistent" ] ,
28- "array-bracket-spacing" : [ "error" , "never" ] ,
29- "array-callback-return" : "error" ,
30- "array-element-newline" : [
31- "error" ,
32- {
33- ArrayExpression : "consistent" ,
34- ArrayPattern : { minItems : 3 }
35- }
36- ] ,
37- "arrow-spacing" : "error" ,
38- "brace-style" : [ "error" , "1tbs" ] ,
39- "comma-dangle" : [ "error" , "never" ] ,
40- "comma-spacing" : [
41- "error" ,
42- {
43- after : true ,
44- before : false
45- }
46- ] ,
47- curly : [ "error" , "all" ] ,
48- "default-case" : "off" ,
49- eqeqeq : [ "error" , "always" ] ,
50- "func-call-spacing" : [ "error" , "never" ] ,
51- "function-call-argument-newline" : [ "error" , "consistent" ] ,
52- indent : [ "error" , 4 , { SwitchCase : 1 , ignoredNodes : [ "ConditionalExpression" ] } ] ,
53- "jsdoc/newline-after-description" : 0 , // Required for vs code auto formatting
54- "jsdoc/require-hyphen-before-param-description" : 1 ,
55- "jsdoc/require-jsdoc" : [
56- "error" ,
57- {
58- require : {
59- ArrowFunctionExpression : true ,
60- ClassExpression : true ,
61- FunctionDeclaration : true ,
62- FunctionExpression : true ,
63- MethodDefinition : true
25+ {
26+ files : [ "*.ts" , "*.tsx" ] ,
27+ plugins : {
28+ tsdoc : tsDocConfig
29+ } ,
30+ rules : {
31+ "tsdoc/syntax" : "warn"
32+ }
33+ } ,
34+ {
35+ plugins : {
36+ jsdoc : jsDocConfig ,
37+ "unused-imports" : unusedImports
38+ } ,
39+ languageOptions,
40+ rules : {
41+ "array-bracket-newline" : [ "error" , "consistent" ] ,
42+ "array-bracket-spacing" : [ "error" , "never" ] ,
43+ "array-callback-return" : "error" ,
44+ "array-element-newline" : [
45+ "error" ,
46+ {
47+ ArrayExpression : "consistent" ,
48+ ArrayPattern : { minItems : 3 }
49+ }
50+ ] ,
51+ "arrow-spacing" : "error" ,
52+ "brace-style" : [ "error" , "1tbs" ] ,
53+ "comma-dangle" : [ "error" , "never" ] ,
54+ "comma-spacing" : [
55+ "error" ,
56+ {
57+ after : true ,
58+ before : false
59+ }
60+ ] ,
61+ curly : [ "error" , "all" ] ,
62+ "default-case" : "off" ,
63+ eqeqeq : [ "error" , "always" ] ,
64+ "func-call-spacing" : [ "error" , "never" ] ,
65+ "function-call-argument-newline" : [ "error" , "consistent" ] ,
66+ indent : [ "error" , 4 , { SwitchCase : 1 , ignoredNodes : [ "ConditionalExpression" ] } ] ,
67+ "jsdoc/newline-after-description" : 0 ,
68+ "jsdoc/require-hyphen-before-param-description" : 1 ,
69+ "jsdoc/require-jsdoc" : [
70+ "error" ,
71+ {
72+ require : {
73+ ArrowFunctionExpression : true ,
74+ ClassDeclaration : true ,
75+ ClassExpression : true ,
76+ FunctionDeclaration : true ,
77+ FunctionExpression : true ,
78+ MethodDefinition : true
79+ } ,
80+ contexts : [
81+ "TSInterfaceDeclaration" ,
82+ "TSTypeAliasDeclaration" ,
83+ "TSEnumDeclaration" ,
84+ "TSPropertySignature"
85+ ]
6486 }
65- }
66- ] ,
67- "keyword-spacing " : [ "error" , { after : true , before : true } ] ,
68- "no-console " : "error" ,
69- "no-dupe-else-if " : "error " ,
70- "no-extend-native " : "off " ,
71- "no-nested-ternary " : "error" ,
72- "object-curly-newline " : [ "error" , { consistent : true , multiline : true } ] ,
73- "object-curly-spacing " : [ "error" , "always" ] ,
74- "object-property-newline " : [ "error" , { allowAllPropertiesOnSameLine : true } ] ,
75- "padding-line-between-statements" : [
76- "error" ,
77- // Always one empty line before return statement
78- {
79- blankLine : "always " ,
80- next : "return" ,
81- prev : "*"
82- } ,
83- // Always one empty line between methods
84- {
85- blankLine : "always" ,
86- next : [ "block-like" , "multiline-block-like" ] ,
87- prev : [ "block-like" , "multiline-block-like" ]
88- } ,
89- // Avoids more than one empty line
90- {
91- blankLine : "never " ,
92- next : "empty" ,
93- prev : "empty"
94- }
95- ] ,
96- "space-before-blocks" : "error"
87+ ] ,
88+ "keyword-spacing" : [ "error" , { after : true , before : true } ] ,
89+ "no-console " : "error" ,
90+ "no-dupe-else-if " : "error" ,
91+ "no-extend-native " : "off " ,
92+ "no-nested-ternary " : "error " ,
93+ "object-curly-newline " : [ "error" , { consistent : true , multiline : true } ] ,
94+ "object-curly-spacing " : [ "error" , "always" ] ,
95+ "object-property-newline " : [ "error" , { allowAllPropertiesOnSameLine : true } ] ,
96+ "padding-line-between-statements " : [
97+ "error" ,
98+ // Always one empty line before return statement
99+ {
100+ blankLine : "always" ,
101+ next : "return " ,
102+ prev : "*"
103+ } ,
104+ // Always one empty line between methods
105+ {
106+ blankLine : "always" ,
107+ next : [ "block-like" , "multiline-block-like" ] ,
108+ prev : [ "block-like" , "multiline-block-like" ]
109+ } ,
110+ // Avoids more than one empty line
111+ {
112+ blankLine : "never" ,
113+ next : "empty " ,
114+ prev : "empty"
115+ }
116+ ] ,
117+ "space-before-blocks" : "error"
118+ }
97119 }
98- } ;
120+ ] ;
0 commit comments