1
+ import prettier from "eslint-plugin-prettier" ;
2
+ import globals from "globals" ;
3
+ import babelParser from "@babel/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 [ ...compat . extends ( "eslint:recommended" , "prettier" ) , {
18
+ plugins : {
19
+ prettier,
20
+ } ,
21
+
22
+ files : [ "**/*.js" ] ,
23
+
24
+ ignores : [
25
+ "node_modules/**" ,
26
+ ] ,
27
+
28
+ languageOptions : {
29
+ globals : {
30
+ ...globals . node ,
31
+ } ,
32
+
33
+ parser : babelParser ,
34
+ ecmaVersion : 2021 ,
35
+ sourceType : "script" ,
36
+
37
+ parserOptions : {
38
+ requireConfigFile : false ,
39
+ } ,
40
+ } ,
41
+
42
+ rules : {
43
+ "arrow-spacing" : [ "warn" , {
44
+ before : true ,
45
+ after : true ,
46
+ } ] ,
47
+
48
+ "brace-style" : [ "error" , "1tbs" , {
49
+ allowSingleLine : true ,
50
+ } ] ,
51
+
52
+ "comma-dangle" : [ "error" , "always-multiline" ] ,
53
+ "comma-spacing" : "error" ,
54
+ "comma-style" : "error" ,
55
+ curly : [ "error" , "multi-line" , "consistent" ] ,
56
+ "dot-location" : [ "error" , "property" ] ,
57
+ "handle-callback-err" : "off" ,
58
+ indent : "off" ,
59
+ "keyword-spacing" : "error" ,
60
+
61
+ "max-nested-callbacks" : [ "error" , {
62
+ max : 4 ,
63
+ } ] ,
64
+
65
+ "max-statements-per-line" : [ "error" , {
66
+ max : 2 ,
67
+ } ] ,
68
+
69
+ "no-console" : "off" ,
70
+ "no-empty-function" : "error" ,
71
+ "no-floating-decimal" : "error" ,
72
+ "no-inline-comments" : "error" ,
73
+ "no-lonely-if" : "error" ,
74
+ "no-multi-spaces" : "error" ,
75
+
76
+ "no-multiple-empty-lines" : [ "error" , {
77
+ max : 2 ,
78
+ maxEOF : 1 ,
79
+ maxBOF : 0 ,
80
+ } ] ,
81
+
82
+ "no-shadow" : [ "error" , {
83
+ allow : [ "err" , "resolve" , "reject" ] ,
84
+ } ] ,
85
+
86
+ "no-trailing-spaces" : [ "error" ] ,
87
+ "no-var" : "error" ,
88
+ "object-curly-spacing" : [ "error" , "always" ] ,
89
+ "prefer-const" : "error" ,
90
+ "prettier/prettier" : [
91
+ "error" ,
92
+ {
93
+ "endOfLine" : "auto" ,
94
+ }
95
+ ] ,
96
+ semi : [ "error" , "always" ] ,
97
+ "space-before-blocks" : "error" ,
98
+ "space-in-parens" : "error" ,
99
+ "space-infix-ops" : "error" ,
100
+ "space-unary-ops" : "error" ,
101
+ "spaced-comment" : "error" ,
102
+ "no-unused-vars" : "warn" ,
103
+ yoda : "error" ,
104
+ } ,
105
+ } ] ;
0 commit comments