1
+ import typescriptEslint from "@typescript-eslint/eslint-plugin" ;
2
+ import globals from "globals" ;
3
+ import tsParser from "@typescript-eslint/parser" ;
4
+ import path from "node:path" ;
5
+ import { fileURLToPath } from "node:url" ;
6
+ import js from "@eslint/js" ;
7
+ import { FlatCompat } from "@eslint/eslintrc" ;
8
+
9
+ const __filename = fileURLToPath ( import . meta. url ) ;
10
+ const __dirname = path . dirname ( __filename ) ;
11
+ const compat = new FlatCompat ( {
12
+ baseDirectory : __dirname ,
13
+ recommendedConfig : js . configs . recommended ,
14
+ allConfig : js . configs . all
15
+ } ) ;
16
+
17
+ export default [ {
18
+ ignores : [ "**/locales/" , "**/dist/" , "**/scripts/" ] ,
19
+ } , ...compat . extends (
20
+ "eslint:recommended" ,
21
+ "plugin:@typescript-eslint/eslint-recommended" ,
22
+ "plugin:@typescript-eslint/recommended" ,
23
+ ) , {
24
+ plugins : {
25
+ "@typescript-eslint" : typescriptEslint ,
26
+ } ,
27
+
28
+ languageOptions : {
29
+ globals : {
30
+ ...globals . node ,
31
+ } ,
32
+
33
+ parser : tsParser ,
34
+ ecmaVersion : 2022 ,
35
+ sourceType : "module" ,
36
+ } ,
37
+
38
+ rules : {
39
+ "arrow-spacing" : [ "warn" , {
40
+ before : true ,
41
+ after : true ,
42
+ } ] ,
43
+
44
+ "brace-style" : [ "error" , "1tbs" , {
45
+ allowSingleLine : true ,
46
+ } ] ,
47
+
48
+ "comma-dangle" : [ "error" , "always-multiline" ] ,
49
+ "comma-spacing" : "error" ,
50
+ "comma-style" : "error" ,
51
+ curly : [ "error" , "multi-line" , "consistent" ] ,
52
+ "dot-location" : [ "error" , "property" ] ,
53
+ "handle-callback-err" : "off" ,
54
+ "keyword-spacing" : "error" ,
55
+
56
+ "max-nested-callbacks" : [ "error" , {
57
+ max : 4 ,
58
+ } ] ,
59
+
60
+ "max-statements-per-line" : [ "error" , {
61
+ max : 2 ,
62
+ } ] ,
63
+
64
+ "no-console" : "off" ,
65
+ "no-empty-function" : "error" ,
66
+ "no-floating-decimal" : "error" ,
67
+ "no-inline-comments" : "error" ,
68
+ "no-lonely-if" : "error" ,
69
+ "no-multi-spaces" : "error" ,
70
+
71
+ "no-multiple-empty-lines" : [ "error" , {
72
+ max : 2 ,
73
+ maxEOF : 1 ,
74
+ maxBOF : 0 ,
75
+ } ] ,
76
+
77
+ "no-return-await" : "error" ,
78
+ "no-shadow" : "off" ,
79
+ "no-trailing-spaces" : [ "error" ] ,
80
+ "no-var" : "error" ,
81
+ "object-curly-spacing" : [ "error" , "always" ] ,
82
+ "prefer-const" : "error" ,
83
+
84
+ quotes : [ "error" , "single" , {
85
+ avoidEscape : true ,
86
+ allowTemplateLiterals : false ,
87
+ } ] ,
88
+
89
+ semi : [ "error" , "always" ] ,
90
+ "space-before-blocks" : "error" ,
91
+
92
+ "space-before-function-paren" : [ "error" , {
93
+ anonymous : "never" ,
94
+ named : "never" ,
95
+ asyncArrow : "always" ,
96
+ } ] ,
97
+
98
+ "space-in-parens" : "error" ,
99
+ "space-infix-ops" : "error" ,
100
+ "space-unary-ops" : "error" ,
101
+ "spaced-comment" : "error" ,
102
+ yoda : "error" ,
103
+
104
+ "@typescript-eslint/no-shadow" : [ "error" , {
105
+ allow : [ "err" , "resolve" , "reject" ] ,
106
+ } ] ,
107
+
108
+ "@typescript-eslint/explicit-function-return-type" : [ "error" , {
109
+ allowTypedFunctionExpressions : false ,
110
+ } ] ,
111
+
112
+ "@typescript-eslint/consistent-type-imports" : [ "error" ] ,
113
+
114
+ "@typescript-eslint/no-unused-vars" : [ "error" , {
115
+ argsIgnorePattern : "^_" ,
116
+ varsIgnorePattern : "^_" ,
117
+ caughtErrorsIgnorePattern : "^_" ,
118
+ } ] ,
119
+ } ,
120
+ } ] ;
0 commit comments