2
2
3
3
const js = require ( "@eslint/js" ) ;
4
4
const { FlatCompat } = require ( "@eslint/eslintrc" ) ;
5
- const eslintPluginMarkdown = require ( "eslint-plugin-markdown" ) ;
6
5
const eslintPluginEslintPluginAll = require ( "eslint-plugin-eslint-plugin/configs/all" ) ;
6
+ const eslintPluginMarkdown = require ( "eslint-plugin-markdown" ) ;
7
7
const globals = require ( "globals" ) ;
8
8
9
9
const compat = new FlatCompat ( {
10
10
baseDirectory : __dirname ,
11
- recommendedConfig : js . configs . recommended
11
+ recommendedConfig : js . configs . recommended ,
12
12
} ) ;
13
13
14
14
module . exports = [
15
15
...compat . extends (
16
- "plugin:node/recommended" ,
17
16
"plugin:eslint-comments/recommended" ,
18
- "plugin:unicorn/recommended"
17
+ "plugin:node/recommended" ,
18
+ "plugin:prettier/recommended" ,
19
+ "plugin:unicorn/recommended" ,
19
20
) ,
20
21
21
22
eslintPluginEslintPluginAll ,
22
23
23
24
// Apply mocha config only to tests.
24
- ...compat . extends ( "plugin:mocha/recommended" ) . map ( config => ( { ...config ,
25
- files : [ "tests/**/*.js" ] } ) ) ,
25
+ ...compat
26
+ . extends ( "plugin:mocha/recommended" )
27
+ . map ( ( config ) => ( { ...config , files : [ "tests/**/*.js" ] } ) ) ,
26
28
27
29
{
28
30
languageOptions : {
29
- "sourceType" : "script" ,
30
- "ecmaVersion" : "latest" ,
31
- "globals" : globals . node
32
- }
33
- } ,
34
- {
35
- "rules" :
36
- {
37
- "array-bracket-spacing" : [ "error" , "never" ] ,
38
- "block-spacing" : [ "error" , "always" ] ,
39
- "brace-style" : [ "error" , "1tbs" ] ,
40
- "camelcase" : [ "error" , { "properties" : "always" } ] ,
41
- "comma-dangle" : [ "error" , "never" ] ,
42
- "comma-spacing" : [ "error" , { "before" : false ,
43
- "after" : true } ] ,
44
- "comma-style" : [ "error" , "last" ] ,
45
- "complexity" : [ "error" , 10 ] ,
46
- "computed-property-spacing" : [ "error" , "never" ] ,
31
+ sourceType : "script" ,
32
+ ecmaVersion : "latest" ,
33
+ globals : globals . node ,
34
+ } ,
35
+ rules : {
36
+ camelcase : [ "error" , { properties : "always" } ] ,
37
+ complexity : [ "error" , 10 ] ,
47
38
"consistent-return" : "error" ,
48
39
"consistent-this" : [ "error" , "self" ] ,
49
- " curly" : [ "error" , "multi-line" ] ,
40
+ curly : [ "error" , "multi-line" ] ,
50
41
"default-case" : "error" ,
51
- "dot-location" : [ "error" , "property" ] ,
52
42
"dot-notation" : "error" ,
53
- "eol-last" : "error" ,
54
- "eqeqeq" : "error" ,
55
- "func-call-spacing" : "error" ,
43
+ eqeqeq : "error" ,
56
44
"func-style" : [ "error" , "declaration" ] ,
57
45
"guard-for-in" : "error" ,
58
- "indent" : [ "error" , 4 , { "SwitchCase" : 1 ,
59
- "VariableDeclarator" : 1 } ] ,
60
- "key-spacing" : [ "error" , { "beforeColon" : false ,
61
- "afterColon" : true } ] ,
62
- "keyword-spacing" : [ "error" , { "before" : true ,
63
- "after" : true } ] ,
64
- "linebreak-style" : [ "error" , "unix" ] ,
65
46
"lines-around-comment" : [
66
47
"error" ,
67
48
{
68
- " beforeBlockComment" : false ,
69
- " afterBlockComment" : false ,
70
- " beforeLineComment" : true ,
71
- " afterLineComment" : false ,
72
- " allowBlockStart" : true ,
73
- " allowBlockEnd" : true ,
74
- " allowObjectStart" : true ,
75
- " allowObjectEnd" : true ,
76
- " allowArrayStart" : true ,
77
- " allowArrayEnd" : true
78
- }
49
+ beforeBlockComment : false ,
50
+ afterBlockComment : false ,
51
+ beforeLineComment : true ,
52
+ afterLineComment : false ,
53
+ allowBlockStart : true ,
54
+ allowBlockEnd : true ,
55
+ allowObjectStart : true ,
56
+ allowObjectEnd : true ,
57
+ allowArrayStart : true ,
58
+ allowArrayEnd : true ,
59
+ } ,
79
60
] ,
80
61
"max-depth" : [ "error" , 5 ] ,
81
- "new-cap" : [ "error" , { "newIsCap" : true ,
82
- "capIsNew" : true } ] ,
83
- "new-parens" : "error" ,
62
+ "new-cap" : [ "error" , { newIsCap : true , capIsNew : true } ] ,
84
63
"no-array-constructor" : "error" ,
85
64
"no-caller" : "error" ,
86
65
"no-catch-shadow" : "error" ,
@@ -102,10 +81,7 @@ module.exports = [
102
81
"no-ex-assign" : "error" ,
103
82
"no-extend-native" : "error" ,
104
83
"no-extra-boolean-cast" : "error" ,
105
- "no-extra-parens" : "error" ,
106
- "no-extra-semi" : "error" ,
107
84
"no-fallthrough" : "error" ,
108
- "no-floating-decimal" : "error" ,
109
85
"no-func-assign" : "error" ,
110
86
"no-implied-eval" : "error" ,
111
87
"no-invalid-regexp" : "error" ,
@@ -115,10 +91,7 @@ module.exports = [
115
91
"no-lonely-if" : "error" ,
116
92
"no-loop-func" : "error" ,
117
93
"no-mixed-requires" : "error" ,
118
- "no-mixed-spaces-and-tabs" : "error" ,
119
- "no-multi-spaces" : [ "error" , { "ignoreEOLComments" : true } ] ,
120
94
"no-multi-str" : "error" ,
121
- "no-multiple-empty-lines" : "error" ,
122
95
"no-unsafe-negation" : "error" ,
123
96
"no-nested-ternary" : "error" ,
124
97
"no-new-func" : "error" ,
@@ -156,54 +129,61 @@ module.exports = [
156
129
"no-useless-return" : "error" ,
157
130
"no-var" : "error" ,
158
131
"no-warning-comments" : "error" ,
159
- "no-whitespace-before-property" : "error" ,
160
132
"no-with" : "error" ,
161
- "object-curly-newline" : [ "error" , { "consistent" : true } ] ,
162
- "object-curly-spacing" : [ "error" , "always" ] ,
163
- "object-property-newline" : "error" ,
164
133
"operator-assignment" : [ "error" , "always" ] ,
165
- "operator-linebreak" : [ "error" , "after" ] ,
166
- "padded-blocks" : [ "error" , "never" ] ,
167
134
"prefer-const" : "error" ,
168
135
"prefer-template" : "error" ,
169
- "quote-props" : [ "error" , "consistent" ] ,
170
- "quotes" : [ "error" , "double" ] ,
171
- "radix" : "error" ,
172
- "semi" : [ "error" , "always" ] ,
173
- "semi-spacing" : [ "error" , { "before" : false ,
174
- "after" : true } ] ,
175
- "space-before-blocks" : [ "error" , "always" ] ,
176
- "space-before-function-paren" : [ "error" , { "anonymous" : "always" ,
177
- "named" : "never" } ] ,
178
- "space-in-parens" : [ "error" , "never" ] ,
179
- "space-infix-ops" : "error" ,
180
- "space-unary-ops" : [ "error" , { "words" : true ,
181
- "nonwords" : false } ] ,
182
- "spaced-comment" : [ "error" , "always" , { "exceptions" : [ "-" ] } ] ,
183
- "strict" : [ "error" , "global" ] ,
184
- "template-curly-spacing" : [ "error" , "never" ] ,
136
+ radix : "error" ,
137
+ "spaced-comment" : [ "error" , "always" , { exceptions : [ "-" ] } ] ,
138
+ strict : [ "error" , "global" ] ,
185
139
"use-isnan" : "error" ,
186
- "valid-jsdoc" : [ "error" , {
187
- "prefer" : {
188
- "return" : "returns"
189
- }
190
- } ] ,
140
+ "valid-jsdoc" : [
141
+ "error" ,
142
+ {
143
+ prefer : {
144
+ return : "returns" ,
145
+ } ,
146
+ } ,
147
+ ] ,
191
148
"valid-typeof" : "error" ,
192
- "wrap-iife" : "error" ,
193
- "yoda" : [ "error" , "never" ] ,
149
+ yoda : [ "error" , "never" ] ,
194
150
195
151
// eslint-plugin-eslint-plugin
196
- "eslint-plugin/meta-property-ordering" : [ "error" , [
197
- "type" , "docs" , "fixable" , "messages" , "schema" , "deprecated" , "replacedBy"
198
- ] ] ,
199
- "eslint-plugin/require-meta-docs-url" : [ "error" , {
200
- "pattern" : "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/{{name}}.md"
201
- } ] ,
152
+ "eslint-plugin/meta-property-ordering" : [
153
+ "error" ,
154
+ [
155
+ "type" ,
156
+ "docs" ,
157
+ "fixable" ,
158
+ "messages" ,
159
+ "schema" ,
160
+ "deprecated" ,
161
+ "replacedBy" ,
162
+ ] ,
163
+ ] ,
164
+ "eslint-plugin/require-meta-docs-url" : [
165
+ "error" ,
166
+ {
167
+ pattern :
168
+ "https://github.com/platinumazure/eslint-plugin-qunit/blob/master/docs/rules/{{name}}.md" ,
169
+ } ,
170
+ ] ,
202
171
203
172
// eslint-plugin-node
204
- "node/no-missing-require" : [ "error" , {
205
- "allowModules" : [ "@typescript-eslint/parser" ]
206
- } ] ,
173
+ "node/no-missing-require" : [
174
+ "error" ,
175
+ {
176
+ allowModules : [ "@typescript-eslint/parser" ] ,
177
+ } ,
178
+ ] ,
179
+
180
+ // prettier
181
+ "prettier/prettier" : [
182
+ "error" ,
183
+ {
184
+ tabWidth : 4 ,
185
+ } ,
186
+ ] ,
207
187
208
188
// eslint-plugin-unicorn
209
189
"unicorn/consistent-function-scoping" : "off" ,
@@ -214,35 +194,32 @@ module.exports = [
214
194
// eslint-disable-next-line no-warning-comments
215
195
"unicorn/prefer-at" : "off" , // TODO: enable once we raise Node requirement to v16.6.0
216
196
"unicorn/prefer-module" : "off" ,
217
- "unicorn/prevent-abbreviations" : "off"
218
- }
197
+ "unicorn/prevent-abbreviations" : "off" ,
198
+ } ,
219
199
} ,
220
200
{
221
201
files : [ "**/*.md" ] ,
222
202
plugins : { markdown : eslintPluginMarkdown } ,
223
- processor : "markdown/markdown"
203
+ processor : "markdown/markdown" ,
224
204
} ,
225
205
{
226
- "files" : [ "**/*.md/*.js" , "**/*.md/*.javascript" ] ,
227
- "languageOptions" : {
228
- "parserOptions" : {
229
- "sourceType" : "module"
230
- }
206
+ // Markdown code samples.
207
+ files : [ "**/*.md/*.js" , "**/*.md/*.javascript" ] ,
208
+ languageOptions : {
209
+ parserOptions : {
210
+ sourceType : "module" ,
211
+ } ,
231
212
} ,
232
- "rules" : {
233
- "brace-style" : "off" ,
234
- "eqeqeq" : "off" ,
213
+ rules : {
214
+ eqeqeq : "off" ,
235
215
"guard-for-in" : "off" ,
236
216
"no-constant-condition" : "off" ,
237
217
"no-empty-function" : "off" ,
238
218
"no-undef" : "off" ,
239
219
"no-unused-expressions" : "off" ,
240
220
"no-unused-vars" : "off" ,
241
221
"no-var" : "off" ,
242
- "quotes" : "off" ,
243
- "space-before-function-paren" : "off" ,
244
- "strict" : "off"
245
- }
246
- }
222
+ strict : "off" ,
223
+ } ,
224
+ } ,
247
225
] ;
248
-
0 commit comments