1+ module . exports = {
2+ "env" : {
3+ "browser" : true ,
4+ "es6" : true
5+ } ,
6+ "extends" : "eslint:recommended" ,
7+ "globals" : {
8+ angular : true ,
9+ browser : true ,
10+ expect : true ,
11+ element : true ,
12+ by : true ,
13+ describe : true ,
14+ it : true ,
15+ exports : true ,
16+ require : true ,
17+ __dirname : true ,
18+ } ,
19+ rules : {
20+ /* Whitespace rules */
21+
22+ // Require 2 space indentation,
23+ indent : [ "warn" , 2 , {
24+ // Require 'case' to be on the same indentation level as 'switch'
25+ SwitchCase : 0 ,
26+ // Require indentation for functions and parameters.
27+ FunctionDeclaration : { body : 1 , parameters : 1 } ,
28+ // Require indentation for function call arguments
29+ CallExpression : { arguments : 1 } ,
30+ // Don't check the indentation of chained member expressions.
31+ // eslint isn't smart enough to let us permit no up-indenting at
32+ // the global indentation level 0.
33+ MemberExpression : "off" ,
34+ } ] ,
35+ // Require no spaces before commas, but require spaces after commas.
36+ "comma-spacing" : [ "warn" , { before : false , after : true } ] ,
37+ // Require a single space after :, but not before it.
38+ "key-spacing" : [ "warn" , { beforeColon : false , afterColon : true } ] ,
39+ // Require spaces after if, else, etc.
40+ "keyword-spacing" : "warn" ,
41+ "no-multiple-empty-lines" : [ "warn" , { max : 1 } ] ,
42+ // Disallow `foo .x`, `foo. y`, etc.
43+ "no-whitespace-before-property" : "warn" ,
44+ // Disallow spaces before semicolons.
45+ "semi-spacing" : [ "warn" , { before : false , after : true } ] ,
46+ // Disallow multiple spaces around operators, etc.
47+ "no-multi-spaces" : "warn" ,
48+ // Require a single space before opening braces.
49+ "space-before-blocks" : [ "warn" , {
50+ functions : "always" ,
51+ keywords : "always" ,
52+ classes : "always" ,
53+ } ] ,
54+ // Require NO spaces before the function parentheses.
55+ "space-before-function-paren" : [ "warn" , "never" ] ,
56+ // Disallow redundant spaces inside parentheses.
57+ "space-in-parens" : [ "warn" , "never" ] ,
58+ // Require spaces around infix operators.
59+ "space-infix-ops" : "warn" ,
60+ // Require a single space after 'new', 'delete', etc.,
61+ // but require NO spaces after ++, !, etc.
62+ "space-unary-ops" : [ "warn" , {
63+ words : true ,
64+ nonwords : false ,
65+ } ] ,
66+ // Disallow redundant spaces inside square brackets.
67+ "array-bracket-spacing" : [ "warn" , "never" ] ,
68+ // Require files to end with a single newline character.
69+ "eol-last" : "warn" ,
70+ // Require lines to end with Unix \n newline characters only.
71+ "linebreak-style" : [ "warn" , "unix" ] ,
72+ // Require spaces before and after the => in arrow functions.
73+ "arrow-spacing" : [ "warn" , { before : true , after : true } ] ,
74+ // Require trailing commas across many lines.
75+ "comma-dangle" : [ "warn" , {
76+ arrays : "always-multiline" ,
77+ objects : "always-multiline" ,
78+ imports : "always-multiline" ,
79+ exports : "always-multiline" ,
80+ functions : "always-multiline" ,
81+ } ] ,
82+ // Require commas to be on the end of lines, not at the start.
83+ "comma-style" : [ "warn" , "last" ] ,
84+ // Don't allow extra blank lines inside of blocks.
85+ "padded-blocks" : [ "warn" , "never" ] ,
86+
87+ /* Other style rules */
88+
89+ // enforce lowerCamelCase, but not on properties of objects.
90+ camelcase : [ "warn" , { properties : "never" } ] ,
91+ // Require dots across lines to start on the second line.
92+ "dot-location" : [ "warn" , "property" ] ,
93+ // Encourage .x over ['x']
94+ // Allow keywords also, which are supported in ES5.
95+ "dot-notation" : [ "warn" , { allowKeywords : true } ] ,
96+ // Disallow 'return' in an 'else' block.
97+ "no-else-return" : "warn" ,
98+ // Disallow `"" + x` and `+x`., etc. !!x will still be allowed.
99+ "no-implicit-coercion" : [ "error" , {
100+ boolean : false ,
101+ number : true ,
102+ string : true ,
103+ } ] ,
104+ "newline-before-return" : "warn" ,
105+ // Prefer no quotes for properties.
106+ "quote-props" : [ "warn" , "as-needed" , {
107+ keywords : false ,
108+ numbers : false ,
109+ } ] ,
110+ /* Style rules which avoid semantic problems later... */
111+
112+ // Require braces for statements always
113+ curly : "error" ,
114+ // Require there to be no semicolons at the end of lines.
115+ // semicolons should appear at the start of some lines instead.
116+ semi : [ "error" , "never" ] ,
117+ // Complain when some lines do not start with semicolons.
118+ "no-unexpected-multiline" : "error" ,
119+ // Disallow labelled loops, which are hard to follow.
120+ "no-labels" : "error" ,
121+ // Require functions to either always or never return values.
122+ "consistent-return" : "error" ,
123+ // Disallow lexical declarations in case blocks.
124+ "no-case-declarations" : "error" ,
125+ // Disallow blocks which do nothing in ES5.
126+ "no-lone-blocks" : "error" ,
127+ // Disallow f.call() and f.apply() when f() is the same.
128+ "no-useless-call" : "error" ,
129+ // Disable the comma operator, which is dumb.
130+ "no-sequences" : "error" ,
131+ // Disable Yoda Conditions like 3 === x
132+ yoda : [ "error" , "never" ] ,
133+ // Disallow nested ternary expressions, which are hard to follow.
134+ "no-nested-ternary" : "error" ,
135+ // Allow unused variables, for now...
136+ "no-unused-vars" : "off" ,
137+ // Require ES6-style imports to be sorted.
138+ "sort-imports" : "warn" ,
139+
140+ /* Semantic rules */
141+
142+ // Require === over ==, except for == null.
143+ eqeqeq : [ "error" , "allow-null" ] ,
144+ // Disallow x === -0. in favour of x === 0 or Object.is(x, -0)
145+ "no-compare-neg-zero" : "error" ,
146+ // Disallow conditions which always hold true, like if (true)
147+ "no-constant-condition" : "error" ,
148+ // Require a default: case for switch statements always
149+ "default-case" : "error" ,
150+ // Require hasOwnProperty for for...in loops.
151+ "guard-for-in" : "error" ,
152+ // Disallow var inside if, for, etc.
153+ "block-scoped-var" : "error" ,
154+ // Disallow `var` completely.
155+ "no-var" : "error" ,
156+ // Require one var, let, or const declaration per line.
157+ "one-var" : [ "error" , "never" ] ,
158+ // Disallow const x = y = 1, etc.
159+ "no-multi-assign" : "error" ,
160+ // Insist that `const` should be used instead of `let`, where possible.
161+ "prefer-const" : "warn" ,
162+ // Treat function parameters as if they are `const`.
163+ "func-style" : [ "error" , "expression" ] ,
164+ "no-param-reassign" : "error" ,
165+ // Require setters to always have matching getters, but not
166+ // the other way around.
167+ "accessor-pairs" : "error" ,
168+ // Don't allow alert, confirm, or prompt by default
169+ "no-alert" : "warn" ,
170+ // Require a radix parameter for parseInt.
171+ radix : [ "error" , "always" ] ,
172+ // Require wrapping functions which are called immediately in parens.
173+ "wrap-iife" : [ "error" , "any" ] ,
174+ // Do not allow arrow functions, getters, or setters to be empty.
175+ // This can catch a problem where you write () => {},
176+ // which returns undefined, not an empty object,
177+ // or where you write a getter or setter and forget to get or set
178+ // values.
179+ "no-empty-function" : [ "error" , {
180+ allow : [
181+ "functions" ,
182+ "generatorFunctions" ,
183+ "methods" ,
184+ "generatorMethods" ,
185+ "constructors" ,
186+ ] ,
187+ } ] ,
188+ // Don't complain about parentheses on arrow functions.
189+ // x => foo and (x) => foo may both be used freely.
190+ "arrow-parens" : "off" ,
191+ // Disallow arrow functions where >= might be intended instead.
192+ // If parentheses are used on the RHS, then the arrow function
193+ // operator will be permitted.
194+ "no-confusing-arrow" : [ "error" , { allowParens : true } ] ,
195+ // Prefer arrow functions for callbacks. They are nicer.
196+ "prefer-arrow-callback" : "warn" ,
197+ // Require return values for Array callbacks like for .map
198+ "array-callback-return" : "error" ,
199+ // Warn about using braces for arrow functions when they are not
200+ // needed.
201+ "arrow-body-style" : [ "warn" , "as-needed" ] ,
202+
203+ /* async-await rules */
204+
205+ // Complain about using `return await bar()`, which is bad.
206+ "no-return-await" : "error" ,
207+ // Require `async` functions to have contain an `await`.
208+ "require-await" : "error" ,
209+ // Disallow using `await` in loops.
210+ "no-await-in-loop" : "error" ,
211+ // Require .reject() for promises to be called with Error objects,
212+ // which contain stack traces.
213+ "prefer-promise-reject-errors" : "error" ,
214+
215+ /* Blacklist of bad JS features or confusing syntax */
216+
217+ // Disallow eval(), which is evil.
218+ "no-eval" : "error" ,
219+ // Disallow changing native objects, like Object, Array, etc.
220+ "no-extend-native" : "error" ,
221+ // Disallow empty destructuring patterns for ES6.
222+ "no-empty-pattern" : "error" ,
223+ // Disallow function declaration inside loops.
224+ "no-loop-func" : "error" ,
225+ // Disallow arguments.caller and arguments.callee.
226+ "no-caller" : "error" ,
227+ // Disable use of a Firefox-specific iterator API.
228+ "no-iterator" : "error" ,
229+ // Disallow multiline strings, which are weird.
230+ "no-multi-str" : "error" ,
231+ // Disallow reassigning native objects.
232+ "no-native-reassign" : "error" ,
233+ // Disallow new Function(...) syntax, which is weird.
234+ "no-new-func" : "error" ,
235+ // Disable boxed objects like new String(""), which are just weird.
236+ "no-new-wrappers" : "error" ,
237+ // Disallow use of new without variable assignment.
238+ "no-new" : "error" ,
239+ // Disallow octal string escape codes, which are likely typos.
240+ "no-octal-escape" : "error" ,
241+ // Disallow useless escape sequences, like \@, etc.
242+ "no-useless-escape" : "error" ,
243+ // Disallow __proto__, which is deprecated.
244+ "no-proto" : "error" ,
245+ // Disallow assignment in a return statement, a likely source of errors.
246+ "no-return-assign" : "error" ,
247+ // Disallow location.href = "javascript:..."
248+ "no-script-url" : "error" ,
249+ // Disallow x === x, which is likely to be a typo.
250+ "no-self-compare" : "error" ,
251+ // Disable throwing strings, numbers, etc. as literals.
252+ "no-throw-literal" : "error" ,
253+ // Disallow unused expressions,
254+ "no-unused-expressions" : "error" ,
255+ // Disallow "a" + "b" when "ab" will do.
256+ "no-useless-concat" : "error" ,
257+ // Disable the void operator.
258+ "no-void" : "error" ,
259+ // Disable the evil with statement.
260+ "no-with" : "error" ,
261+ // Disallow deleting variables.
262+ "no-delete-var" : "error" ,
263+ // Disallow shadowing of `undefined`, etc.
264+ "no-shadow-restricted-names" : "error" ,
265+ // Disable shadowing, which is confusing.
266+ "no-shadow" : "error" ,
267+ "no-shadow-restricted-names" : "error" ,
268+ // Disallow `var x = undefined;` when `var x;` is enough.
269+ "no-undef-init" : "error" ,
270+ // Disallow undefined variables, to prevent globals from being created.
271+ "no-undef" : "error" ,
272+ // Require strict mode in functions.
273+ //strict: ["error", "function"],
274+ // Allow `undefined`. It's fine.
275+ "no-undefined" : "off" ,
276+ // Disallow anything from being used before it is defined.
277+ "no-use-before-define" : [ "error" , {
278+ // Allow functions to be hoisted.
279+ functions : false ,
280+ classes : true ,
281+ } ] ,
282+ // Disallow bitwise operators, which are usually typos.
283+ "no-bitwise" : "error" ,
284+ } ,
285+ } ;
0 commit comments