22
33const js = require ( "@eslint/js" ) ;
44const { FlatCompat } = require ( "@eslint/eslintrc" ) ;
5- const eslintPluginMarkdown = require ( "eslint-plugin-markdown" ) ;
65const eslintPluginEslintPluginAll = require ( "eslint-plugin-eslint-plugin/configs/all" ) ;
6+ const eslintPluginMarkdown = require ( "eslint-plugin-markdown" ) ;
77const globals = require ( "globals" ) ;
88
99const compat = new FlatCompat ( {
1010 baseDirectory : __dirname ,
11- recommendedConfig : js . configs . recommended
11+ recommendedConfig : js . configs . recommended ,
1212} ) ;
1313
1414module . exports = [
1515 ...compat . extends (
16- "plugin:node/recommended" ,
1716 "plugin:eslint-comments/recommended" ,
18- "plugin:unicorn/recommended"
17+ "plugin:node/recommended" ,
18+ "plugin:prettier/recommended" ,
19+ "plugin:unicorn/recommended" ,
1920 ) ,
2021
2122 eslintPluginEslintPluginAll ,
2223
2324 // 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" ] } ) ) ,
2628
2729 {
2830 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 ] ,
4738 "consistent-return" : "error" ,
4839 "consistent-this" : [ "error" , "self" ] ,
49- " curly" : [ "error" , "multi-line" ] ,
40+ curly : [ "error" , "multi-line" ] ,
5041 "default-case" : "error" ,
51- "dot-location" : [ "error" , "property" ] ,
5242 "dot-notation" : "error" ,
53- "eol-last" : "error" ,
54- "eqeqeq" : "error" ,
55- "func-call-spacing" : "error" ,
43+ eqeqeq : "error" ,
5644 "func-style" : [ "error" , "declaration" ] ,
5745 "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" ] ,
6546 "lines-around-comment" : [
6647 "error" ,
6748 {
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+ } ,
7960 ] ,
8061 "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 } ] ,
8463 "no-array-constructor" : "error" ,
8564 "no-caller" : "error" ,
8665 "no-catch-shadow" : "error" ,
@@ -102,10 +81,7 @@ module.exports = [
10281 "no-ex-assign" : "error" ,
10382 "no-extend-native" : "error" ,
10483 "no-extra-boolean-cast" : "error" ,
105- "no-extra-parens" : "error" ,
106- "no-extra-semi" : "error" ,
10784 "no-fallthrough" : "error" ,
108- "no-floating-decimal" : "error" ,
10985 "no-func-assign" : "error" ,
11086 "no-implied-eval" : "error" ,
11187 "no-invalid-regexp" : "error" ,
@@ -115,10 +91,7 @@ module.exports = [
11591 "no-lonely-if" : "error" ,
11692 "no-loop-func" : "error" ,
11793 "no-mixed-requires" : "error" ,
118- "no-mixed-spaces-and-tabs" : "error" ,
119- "no-multi-spaces" : [ "error" , { "ignoreEOLComments" : true } ] ,
12094 "no-multi-str" : "error" ,
121- "no-multiple-empty-lines" : "error" ,
12295 "no-unsafe-negation" : "error" ,
12396 "no-nested-ternary" : "error" ,
12497 "no-new-func" : "error" ,
@@ -156,54 +129,61 @@ module.exports = [
156129 "no-useless-return" : "error" ,
157130 "no-var" : "error" ,
158131 "no-warning-comments" : "error" ,
159- "no-whitespace-before-property" : "error" ,
160132 "no-with" : "error" ,
161- "object-curly-newline" : [ "error" , { "consistent" : true } ] ,
162- "object-curly-spacing" : [ "error" , "always" ] ,
163- "object-property-newline" : "error" ,
164133 "operator-assignment" : [ "error" , "always" ] ,
165- "operator-linebreak" : [ "error" , "after" ] ,
166- "padded-blocks" : [ "error" , "never" ] ,
167134 "prefer-const" : "error" ,
168135 "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" ] ,
185139 "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+ ] ,
191148 "valid-typeof" : "error" ,
192- "wrap-iife" : "error" ,
193- "yoda" : [ "error" , "never" ] ,
149+ yoda : [ "error" , "never" ] ,
194150
195151 // 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+ ] ,
202171
203172 // 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+ ] ,
207187
208188 // eslint-plugin-unicorn
209189 "unicorn/consistent-function-scoping" : "off" ,
@@ -214,35 +194,32 @@ module.exports = [
214194 // eslint-disable-next-line no-warning-comments
215195 "unicorn/prefer-at" : "off" , // TODO: enable once we raise Node requirement to v16.6.0
216196 "unicorn/prefer-module" : "off" ,
217- "unicorn/prevent-abbreviations" : "off"
218- }
197+ "unicorn/prevent-abbreviations" : "off" ,
198+ } ,
219199 } ,
220200 {
221201 files : [ "**/*.md" ] ,
222202 plugins : { markdown : eslintPluginMarkdown } ,
223- processor : "markdown/markdown"
203+ processor : "markdown/markdown" ,
224204 } ,
225205 {
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+ } ,
231212 } ,
232- "rules" : {
233- "brace-style" : "off" ,
234- "eqeqeq" : "off" ,
213+ rules : {
214+ eqeqeq : "off" ,
235215 "guard-for-in" : "off" ,
236216 "no-constant-condition" : "off" ,
237217 "no-empty-function" : "off" ,
238218 "no-undef" : "off" ,
239219 "no-unused-expressions" : "off" ,
240220 "no-unused-vars" : "off" ,
241221 "no-var" : "off" ,
242- "quotes" : "off" ,
243- "space-before-function-paren" : "off" ,
244- "strict" : "off"
245- }
246- }
222+ strict : "off" ,
223+ } ,
224+ } ,
247225] ;
248-
0 commit comments