1- ' use strict' ;
1+ " use strict" ;
22
3- const airbnbBase = require ( ' eslint-config-airbnb-base' ) ;
3+ const airbnbBase = require ( " eslint-config-airbnb-base" ) ;
44
55// eslint-disable-next-line import/no-dynamic-require
66const bestPractices = require ( airbnbBase . extends [ 0 ] ) ;
77
88const ignoredProps = bestPractices . rules [
9- ' no-param-reassign'
9+ " no-param-reassign"
1010] [ 1 ] . ignorePropertyModificationsFor . concat (
11- ' err' ,
12- 'x' ,
13- '_' ,
14- ' opts' ,
15- ' options' ,
16- ' settings' ,
17- ' config' ,
18- ' cfg' ,
11+ " err" ,
12+ "x" ,
13+ "_" ,
14+ " opts" ,
15+ " options" ,
16+ " settings" ,
17+ " config" ,
18+ " cfg"
1919) ;
2020
2121// Additional rules that are specific and overriding previous
2222const additionalChanges = {
23- strict : ' off' ,
23+ strict : " off" ,
2424
2525 // Enforce using named functions when regular function is used,
2626 // otherwise use arrow functions
27- ' func-names' : [ ' error' , ' always' ] ,
27+ " func-names" : [ " error" , " always" ] ,
2828 // Always use parens (for consistency).
2929 // https://eslint.org/docs/rules/arrow-parens
30- ' arrow-parens' : [ ' error' , ' always' , { requireForBlockBody : true } ] ,
31- ' prefer-arrow-callback' : [
32- ' error' ,
30+ " arrow-parens" : [ " error" , " always" , { requireForBlockBody : true } ] ,
31+ " prefer-arrow-callback" : [
32+ " error" ,
3333 { allowNamedFunctions : true , allowUnboundThis : true } ,
3434 ] ,
3535 // http://eslint.org/docs/rules/max-params
36- ' max-params' : [ ' error' , { max : 3 } ] ,
36+ " max-params" : [ " error" , { max : 3 } ] ,
3737 // http://eslint.org/docs/rules/max-statements
38- ' max-statements' : [ ' error' , { max : 20 } ] ,
38+ " max-statements" : [ " error" , { max : 20 } ] ,
3939 // http://eslint.org/docs/rules/max-statements-per-line
40- ' max-statements-per-line' : [ ' error' , { max : 1 } ] ,
40+ " max-statements-per-line" : [ " error" , { max : 1 } ] ,
4141 // http://eslint.org/docs/rules/max-nested-callbacks
42- ' max-nested-callbacks' : [ ' error' , { max : 4 } ] ,
42+ " max-nested-callbacks" : [ " error" , { max : 4 } ] ,
4343 // http://eslint.org/docs/rules/max-depth
44- ' max-depth' : [ ' error' , { max : 4 } ] ,
44+ " max-depth" : [ " error" , { max : 4 } ] ,
4545 // enforces no braces where they can be omitted
4646 // https://eslint.org/docs/rules/arrow-body-style
4747 // Never enable for object literal.
48- ' arrow-body-style' : [
49- ' error' ,
50- ' as-needed' ,
48+ " arrow-body-style" : [
49+ " error" ,
50+ " as-needed" ,
5151 { requireReturnForObjectLiteral : false } ,
5252 ] ,
5353 // Allow functions to be use before define because:
5454 // 1) they are hoisted,
5555 // 2) because ensure read flow is from top to bottom
5656 // 3) logically order of the code.
5757 // 4) the only addition is 'typedefs' option, see overrides for TS files
58- ' no-use-before-define' : [
59- ' error' ,
58+ " no-use-before-define" : [
59+ " error" ,
6060 {
6161 functions : false ,
6262 classes : true ,
@@ -67,45 +67,45 @@ const additionalChanges = {
6767 // disallow reassignment of function parameters
6868 // disallow parameter object manipulation except for specific exclusions
6969 // rule: https://eslint.org/docs/rules/no-param-reassign.html
70- ' no-param-reassign' : [
71- ' error' ,
70+ " no-param-reassign" : [
71+ " error" ,
7272 {
7373 props : true ,
7474 ignorePropertyModificationsFor : ignoredProps ,
7575 } ,
7676 ] ,
7777
7878 // disallow declaration of variables that are not used in the code
79- ' no-unused-vars' : [
80- ' error' ,
79+ " no-unused-vars" : [
80+ " error" ,
8181 {
8282 ignoreRestSiblings : true , // airbnb's default
83- vars : ' all' , // airbnb's default
84- varsIgnorePattern : ' ^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))' ,
85- args : ' after-used' , // airbnb's default
86- argsIgnorePattern : ' ^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))' ,
83+ vars : " all" , // airbnb's default
84+ varsIgnorePattern : " ^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))" ,
85+ args : " after-used" , // airbnb's default
86+ argsIgnorePattern : " ^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))" ,
8787
8888 // catch blocks are handled by Unicorns
89- caughtErrors : ' none' ,
89+ caughtErrors : " none" ,
9090 // caughtErrorsIgnorePattern: '^(?:$$|xx|_|__|[iI]gnor(?:e|ing|ed))',
9191 } ,
9292 ] ,
9393} ;
9494
9595const importRules = {
96- ' import/namespace' : [ ' error' , { allowComputed : true } ] ,
97- ' import/no-absolute-path' : ' error' ,
98- ' import/no-webpack-loader-syntax' : ' error' ,
99- ' import/no-self-import' : ' error' ,
96+ " import/namespace" : [ " error" , { allowComputed : true } ] ,
97+ " import/no-absolute-path" : " error" ,
98+ " import/no-webpack-loader-syntax" : " error" ,
99+ " import/no-self-import" : " error" ,
100100
101101 // Enable this sometime in the future when Node.js has ES2015 module support
102102 // 'import/no-cycle': 'error',
103103
104104 // Disabled as it doesn't work with TypeScript
105105 // 'import/newline-after-import': 'error',
106106
107- ' import/no-amd' : ' error' ,
108- ' import/no-duplicates' : ' error' ,
107+ " import/no-amd" : " error" ,
108+ " import/no-duplicates" : " error" ,
109109
110110 // Enable this sometime in the future when Node.js has ES2015 module support
111111 // 'import/unambiguous': 'error',
@@ -116,10 +116,10 @@ const importRules = {
116116 // Looks useful, but too unstable at the moment
117117 // 'import/no-deprecated': 'error',
118118
119- ' import/no-extraneous-dependencies' : ' off' ,
120- ' import/no-mutable-exports' : ' error' ,
121- ' import/no-named-as-default-member' : ' error' ,
122- ' import/no-named-as-default' : ' error' ,
119+ " import/no-extraneous-dependencies" : " off" ,
120+ " import/no-mutable-exports" : " error" ,
121+ " import/no-named-as-default-member" : " error" ,
122+ " import/no-named-as-default" : " error" ,
123123
124124 // Disabled because it's buggy and it also doesn't work with TypeScript
125125 // 'import/no-unresolved': [
@@ -129,32 +129,32 @@ const importRules = {
129129 // }
130130 // ],
131131
132- ' import/order' : ' error' ,
133- ' import/no-unassigned-import' : [
134- ' error' ,
135- { allow : [ ' @babel/polyfill' , ' @babel/register' ] } ,
132+ " import/order" : " error" ,
133+ " import/no-unassigned-import" : [
134+ " error" ,
135+ { allow : [ " @babel/polyfill" , " @babel/register" ] } ,
136136 ] ,
137137
138- ' import/prefer-default-export' : ' off' ,
138+ " import/prefer-default-export" : " off" ,
139139
140140 // Ensure more web-compat
141141 // ! note that it doesn't work in CommonJS
142142 // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
143- ' import/extensions' : ' off' ,
143+ " import/extensions" : " off" ,
144144
145145 // ? Always use named exports. Enable?
146146 // 'import/no-default-export': 'error',
147147
148148 // ? enable?
149- ' import/exports-last' : ' off' ,
149+ " import/exports-last" : " off" ,
150150
151151 // todo: Enable in future.
152152 // Ensures everything is tested (all exports should be used).
153153 // For cases when you don't want or can't test, add eslint-ignore comment!
154154 // see: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unused-modules.md
155- ' import/no-unused-modules' : ' off' ,
155+ " import/no-unused-modules" : " off" ,
156156
157- ' import/no-useless-path-segments' : [ ' error' , { noUselessIndex : false } ] ,
157+ " import/no-useless-path-segments" : [ " error" , { noUselessIndex : false } ] ,
158158} ;
159159
160160module . exports = {
@@ -165,8 +165,8 @@ module.exports = {
165165 node : true ,
166166 commonjs : true ,
167167 } ,
168- extends : [ ' eslint:recommended' , ' airbnb-base' , ' plugin:prettier/recommended' ] ,
169- plugins : [ ' prettier' ] ,
168+ extends : [ " eslint:recommended" , " airbnb-base" , " plugin:prettier/recommended" ] ,
169+ plugins : [ " prettier" ] ,
170170 rules : {
171171 ...additionalChanges ,
172172 ...importRules ,
0 commit comments