1
+ import importPlugin from 'eslint-plugin-import' ;
2
+ import commentsPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs' ;
3
+ import stylistic from '@stylistic/eslint-plugin' ;
4
+ import jseslint from '@eslint/js' ;
5
+ import tseslint from 'typescript-eslint' ;
6
+ import globals from 'globals' ;
7
+
8
+ export default tseslint . config (
9
+ {
10
+ ignores : [ 'build/*' , 'src/infra/database/migrations/*' , 'jest.config.ts' , '**/tmp/**' , '**/coverage/**' , 'eslint.config.mjs' ] ,
11
+ } ,
12
+ jseslint . configs . recommended ,
13
+ tseslint . configs . recommended ,
14
+ importPlugin . flatConfigs . recommended ,
15
+ importPlugin . flatConfigs . typescript ,
16
+ commentsPlugin . recommended ,
17
+ {
18
+ files : [ '**/*.ts' , '**/*.mts' ] ,
19
+ extends : [ ...tseslint . configs . recommended ] ,
20
+ languageOptions : {
21
+ parser : tseslint . parser ,
22
+ ecmaVersion : 2020 ,
23
+ sourceType : 'module' ,
24
+
25
+ globals : {
26
+ ...globals . node ,
27
+ } ,
28
+
29
+ parserOptions : {
30
+ project : './tsconfig.json' ,
31
+ } ,
32
+ } ,
33
+ settings : {
34
+ 'import/resolver' : {
35
+ typescript : {
36
+ alwaysTryTypes : true ,
37
+ project : './tsconfig.lint.json' ,
38
+ }
39
+ } ,
40
+ } ,
41
+ plugins : {
42
+ '@typescript-eslint' : tseslint . plugin ,
43
+ '@stylistic' : stylistic ,
44
+ } ,
45
+ rules : {
46
+ // General rules
47
+ "no-console" : "warn" ,
48
+ "no-duplicate-imports" : "off" ,
49
+ "camelcase" : "warn" ,
50
+ "require-await" : "off" ,
51
+ "arrow-body-style" : [ "warn" , "as-needed" ] ,
52
+ "eqeqeq" : "error" ,
53
+ "object-shorthand" : "warn" ,
54
+ "prefer-const" : "warn" ,
55
+ "consistent-return" : "error" ,
56
+
57
+ // TypeScript rules
58
+ "@typescript-eslint/await-thenable" : "error" ,
59
+ "@typescript-eslint/require-await" : "error" ,
60
+ "@typescript-eslint/no-unnecessary-condition" : "warn" ,
61
+ "@typescript-eslint/no-unused-vars" : [ "warn" , { "argsIgnorePattern" : "req|res|next|err" } ] ,
62
+ "@typescript-eslint/consistent-type-imports" : [ "warn" , { "prefer" : "type-imports" } ] ,
63
+ "@typescript-eslint/no-floating-promises" : "error" ,
64
+
65
+ // Import rules
66
+ "import/default" : "off" ,
67
+ "import/no-duplicates" : [ "error" ] ,
68
+ "import/no-named-as-default-member" : "off" ,
69
+ "import/order" : [
70
+ "warn" ,
71
+ {
72
+ "groups" : [
73
+ [ "builtin" , "external" ] ,
74
+ [ "internal" , "index" , "sibling" , "parent" , "object" ]
75
+ ] ,
76
+ "newlines-between" : "always-and-inside-groups"
77
+ }
78
+ ] ,
79
+
80
+ // Comments rules
81
+ "@eslint-community/eslint-comments/no-unused-disable" : "error" ,
82
+ "@eslint-community/eslint-comments/disable-enable-pair" : [ "error" , { "allowWholeFile" : true } ] ,
83
+
84
+ // Stylistic rules
85
+ "@stylistic/array-bracket-spacing" : [ "warn" , "never" ] ,
86
+ "@stylistic/array-element-newline" : [ "warn" , "consistent" ] ,
87
+ "@stylistic/arrow-spacing" : "warn" ,
88
+ "@stylistic/block-spacing" : "warn" ,
89
+ "@stylistic/brace-style" : [ "warn" , "1tbs" , { "allowSingleLine" : true } ] ,
90
+ "@stylistic/comma-spacing" : [ "warn" , { "before" : false , "after" : true } ] ,
91
+ "@stylistic/computed-property-spacing" : [ "warn" , "never" ] ,
92
+ "@stylistic/comma-style" : [ "warn" , "last" ] ,
93
+ "@stylistic/function-call-spacing" : [ "warn" , "never" ] ,
94
+ "@stylistic/function-call-argument-newline" : [ "warn" , "consistent" ] ,
95
+ "@stylistic/function-paren-newline" : [ "warn" , "multiline-arguments" ] ,
96
+ "@stylistic/indent" : [ 'warn' , 2 ] ,
97
+ "@stylistic/indent-binary-ops" : [ "warn" , 2 ] ,
98
+ "@stylistic/key-spacing" : "warn" ,
99
+ "@stylistic/keyword-spacing" : "warn" ,
100
+ "@stylistic/member-delimiter-style" : [ "warn" , {
101
+ "multiline" : {
102
+ "delimiter" : "semi" ,
103
+ "requireLast" : true
104
+ } ,
105
+ "singleline" : {
106
+ "delimiter" : "semi" ,
107
+ "requireLast" : false
108
+ }
109
+ } ] ,
110
+ "@stylistic/new-parens" : "warn" ,
111
+ "@stylistic/semi" : "warn" ,
112
+ "@stylistic/no-extra-semi" : "warn" ,
113
+ "@stylistic/no-floating-decimal" : "warn" ,
114
+ "@stylistic/no-multi-spaces" : "warn" ,
115
+ "@stylistic/no-multiple-empty-lines" : "warn" ,
116
+ "@stylistic/no-trailing-spaces" : "warn" ,
117
+ "@stylistic/no-whitespace-before-property" : "warn" ,
118
+ "@stylistic/nonblock-statement-body-position" : [ "warn" , "beside" ] ,
119
+ "@stylistic/object-curly-spacing" : [ "warn" , "always" ] ,
120
+ "@stylistic/quote-props" : [ "warn" , "as-needed" ] ,
121
+ "@stylistic/quotes" : [ "warn" , "single" , { "avoidEscape" : true } ] ,
122
+ "@stylistic/rest-spread-spacing" : "warn" ,
123
+ "@stylistic/semi-spacing" : "warn" ,
124
+ "@stylistic/space-before-blocks" : "warn" ,
125
+ "@stylistic/space-before-function-paren" : [ "warn" , { "anonymous" : "ignore" , "named" : "never" , "asyncArrow" : "always" } ] ,
126
+ "@stylistic/space-in-parens" : "warn" ,
127
+ "@stylistic/space-infix-ops" : "warn" ,
128
+ "@stylistic/space-unary-ops" : "warn" ,
129
+ "@stylistic/spaced-comment" : "warn" ,
130
+ "@stylistic/switch-colon-spacing" : "warn" ,
131
+ "@stylistic/template-curly-spacing" : "warn" ,
132
+ "@stylistic/type-annotation-spacing" : "warn" ,
133
+ "@stylistic/type-named-tuple-spacing" : "warn" ,
134
+ "@stylistic/yield-star-spacing" : [ "error" , "after" ] ,
135
+ }
136
+ } ,
137
+ ) ;
0 commit comments