1 | {
|
2 | // http://eslint.org/docs/rules/
|
3 |
|
4 | "ecmaFeatures": {
|
5 | "binaryLiterals": false, // enable binary literals
|
6 | "blockBindings": false, // enable let and const (aka block bindings)
|
7 | "defaultParams": false, // enable default function parameters
|
8 | "forOf": false, // enable for-of loops
|
9 | "generators": false, // enable generators
|
10 | "objectLiteralComputedProperties": false, // enable computed object literal property names
|
11 | "objectLiteralDuplicateProperties": false, // enable duplicate object literal properties in strict mode
|
12 | "objectLiteralShorthandMethods": false, // enable object literal shorthand methods
|
13 | "objectLiteralShorthandProperties": false, // enable object literal shorthand properties
|
14 | "octalLiterals": false, // enable octal literals
|
15 | "regexUFlag": false, // enable the regular expression u flag
|
16 | "regexYFlag": false, // enable the regular expression y flag
|
17 | "templateStrings": false, // enable template strings
|
18 | "unicodeCodePointEscapes": false, // enable code point escapes
|
19 | "jsx": false // enable JSX
|
20 | },
|
21 |
|
22 | "env": {
|
23 | "browser": false, // browser global variables.
|
24 | "node": true, // Node.js global variables and Node.js-specific rules.
|
25 | "amd": false, // defines require() and define() as global variables as per the amd spec.
|
26 | "mocha": false, // adds all of the Mocha testing global variables.
|
27 | "jasmine": false, // adds all of the Jasmine testing global variables for version 1.3 and 2.0.
|
28 | "phantomjs": false, // phantomjs global variables.
|
29 | "jquery": false, // jquery global variables.
|
30 | "prototypejs": false, // prototypejs global variables.
|
31 | "shelljs": false // shelljs global variables.
|
32 | },
|
33 |
|
34 | "globals": {
|
35 | // e.g. "angular": true
|
36 | },
|
37 |
|
38 | "plugins": [
|
39 | // e.g. "react" (must run `npm install eslint-plugin-react` first)
|
40 | ],
|
41 |
|
42 | "rules": {
|
43 | ////////// Possible Errors //////////
|
44 |
|
45 | "comma-dangle": 2, // disallow trailing commas in object literals
|
46 | "no-cond-assign": 2, // disallow assignment in conditional expressions
|
47 | "no-console": 2, // disallow use of console (off by default in the node environment)
|
48 | "no-constant-condition": 2, // disallow use of constant expressions in conditions
|
49 | "no-control-regex": 2, // disallow control characters in regular expressions
|
50 | "no-debugger": 2, // disallow use of debugger
|
51 | "no-dupe-keys": 2, // disallow duplicate keys when creating object literals
|
52 | "no-empty": 2, // disallow empty statements
|
53 | "no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions
|
54 | "no-ex-assign": 2, // disallow assigning to the exception in a catch block
|
55 | "no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
|
56 | "no-extra-parens": 2, // disallow unnecessary parentheses (off by default)
|
57 | "no-extra-semi": 2, // disallow unnecessary semicolons
|
58 | "no-func-assign": 2, // disallow overwriting functions written as function declarations
|
59 | "no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
|
60 | "no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
|
61 | "no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
|
62 | "no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
|
63 | "no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
|
64 | "no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
|
65 | "no-sparse-arrays": 2, // disallow sparse arrays
|
66 | "no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
|
67 | "use-isnan": 2, // disallow comparisons with the value NaN
|
68 | "valid-jsdoc": 2, // Ensure JSDoc comments are valid (off by default)
|
69 | "valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
|
70 |
|
71 |
|
72 | ////////// Best Practices //////////
|
73 |
|
74 | "block-scoped-var": 2, // treat var statements as if they were block scoped (off by default)
|
75 | "complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
|
76 | "consistent-return": 2, // require return statements to either always or never specify values
|
77 | "curly": 2, // specify curly brace conventions for all control statements
|
78 | "default-case": 2, // require default case in switch statements (off by default)
|
79 | "dot-notation": 0, // encourages use of dot notation whenever possible
|
80 | "eqeqeq": 2, // require the use of === and !==
|
81 | "guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
|
82 | "no-alert": 1, // disallow the use of alert, confirm, and prompt
|
83 | "no-caller": 2, // disallow use of arguments.caller or arguments.callee
|
84 | "no-div-regex": 2, // disallow division operators explicitly at beginning of regular expression (off by default)
|
85 | "no-else-return": 2, // disallow else after a return in an if (off by default)
|
86 | "no-empty-label": 2, // disallow use of labels for anything other then loops and switches
|
87 | "no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default)
|
88 | "no-eval": 2, // disallow use of eval()
|
89 | "no-extend-native": 2, // disallow adding to native types
|
90 | "no-extra-bind": 2, // disallow unnecessary function binding
|
91 | "no-fallthrough": 2, // disallow fallthrough of case statements
|
92 | "no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
|
93 | "no-implied-eval": 2, // disallow use of eval()-like methods
|
94 | "no-iterator": 2, // disallow usage of __iterator__ property
|
95 | "no-labels": 0, // disallow use of labeled statements
|
96 | "no-lone-blocks": 2, // disallow unnecessary nested blocks
|
97 | "no-loop-func": 2, // disallow creation of functions within loops
|
98 | "no-multi-spaces": 0, // disallow use of multiple spaces
|
99 | "no-multi-str": 2, // disallow use of multiline strings
|
100 | "no-native-reassign": 2, // disallow reassignments of native objects
|
101 | "no-new": 2, // disallow use of new operator when not part of the assignment or comparison
|
102 | "no-new-func": 2, // disallow use of new operator for Function object
|
103 | "no-new-wrappers": 2, // disallows creating new instances of String, Number, and Boolean
|
104 | "no-octal": 2, // disallow use of octal literals
|
105 | "no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
|
106 | "no-process-env": 0, // disallow use of process.env (off by default)
|
107 | "no-proto": 2, // disallow usage of __proto__ property
|
108 | "no-redeclare": 2, // disallow declaring the same variable more then once
|
109 | "no-return-assign": 2, // disallow use of assignment in return statement
|
110 | "no-script-url": 2, // disallow use of javascript: urls.
|
111 | "no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
|
112 | "no-sequences": 2, // disallow use of comma operator
|
113 | "no-unused-expressions": 2, // disallow usage of expressions in statement position
|
114 | "no-void": 2, // disallow use of void operator (off by default)
|
115 | "no-warning-comments": 1, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default)
|
116 | "no-with": 2, // disallow use of the with statement
|
117 | "radix": 0, // require use of the second argument for parseInt() (off by default)
|
118 | "vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default)
|
119 | "wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default)
|
120 | "yoda": 2, // require or disallow Yoda conditions
|
121 |
|
122 |
|
123 | ////////// Strict Mode //////////
|
124 |
|
125 | "strict": 0, // controls location of Use Strict Directives
|
126 |
|
127 |
|
128 | ////////// Variables //////////
|
129 |
|
130 | "no-catch-shadow": 0, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
|
131 | "no-delete-var": 2, // disallow deletion of variables
|
132 | "no-label-var": 2, // disallow labels that share a name with a variable
|
133 | "no-shadow": 0, // disallow declaration of variables already declared in the outer scope
|
134 | "no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
|
135 | "no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
|
136 | "no-undef-init": 2, // disallow use of undefined when initializing variables
|
137 | "no-undefined": 0, // disallow use of undefined variable (off by default)
|
138 | "no-unused-vars": 2, // disallow declaration of variables that are not used in the code
|
139 | "no-use-before-define": 2, // disallow use of variables before they are defined
|
140 |
|
141 |
|
142 | ////////// Node.js //////////
|
143 |
|
144 | "callback-return": 2, // enforce return after a callback
|
145 | "handle-callback-err": 2, // enforces error handling in callbacks (off by default) (on by default in the node environment)
|
146 | "no-mixed-requires": 0, // disallow mixing regular variable and require declarations (off by default) (on by default in the node environment)
|
147 | "no-new-require": 0, // disallow use of new operator with the require function (off by default) (on by default in the node environment)
|
148 | "no-path-concat": 0, // disallow string concatenation with __dirname and __filename (off by default) (on by default in the node environment)
|
149 | "no-process-exit": 0, // disallow process.exit() (on by default in the node environment)
|
150 | "no-restricted-modules": 0, // restrict usage of specified node modules (off by default)
|
151 | "no-sync": 0, // disallow use of synchronous methods (off by default)
|
152 |
|
153 |
|
154 | ////////// Stylistic Issues //////////
|
155 |
|
156 | "array-bracket-spacing": 0, // enforce spacing inside array brackets
|
157 | "block-spacing": [2, "always"], // disallow or enforce spaces inside of single line blocks
|
158 | "brace-style": 2, // enforce one true brace style (off by default)
|
159 | "camelcase": 2, // require camel case names
|
160 | "comma-spacing": 2, // enforce spacing before and after comma
|
161 | "comma-style": 2, // enforce one true comma style (off by default)
|
162 | "consistent-this": [2, "self"], // enforces consistent naming when capturing the current execution context (off by default)
|
163 | "eol-last": 2, // enforce newline at the end of file, with no multiple empty lines
|
164 | "func-names": 0, // require function expressions to have a name (off by default)
|
165 | "func-style": 0, // enforces use of function declarations or expressions (off by default)
|
166 | "id-length": 0, // this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
|
167 | "id-match": 0, // require identifiers to match the provided regular expression
|
168 | "indent": [2, 2], // specify tab or space width for your code
|
169 | "key-spacing": 2, // enforces spacing between keys and values in object literal properties
|
170 | "lines-around-comment": 2, // enforce empty lines around comments
|
171 | "linebreak-style": 2, // disallow mixed 'LF' and 'CRLF' as linebreaks
|
172 | "max-nested-callbacks": [2, 3], // specify the maximum depth callbacks can be nested (off by default)
|
173 | "new-cap": 2, // require a capital letter for constructors
|
174 | "new-parens": 2, // disallow the omission of parentheses when invoking a constructor with no arguments
|
175 | "newline-after-var": 0, // require or disallow an empty newline after variable declarations
|
176 | "no-array-constructor": 2, // disallow use of the Array constructor
|
177 | "no-continue": 2, // disallow use of the continue statement
|
178 | "no-inline-comments": 0, // disallow comments inline after code (off by default)
|
179 | "no-lonely-if": 2, // disallow if as the only statement in an else block (off by default)
|
180 | "no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
|
181 | "no-multiple-empty-lines": [2, {"max": 2}], // disallow multiple empty lines (off by default)
|
182 | "no-nested-ternary": 2, // disallow nested ternary expressions (off by default)
|
183 | "no-new-object": 2, // disallow use of the Object constructor
|
184 | "no-spaced-func": 2, // disallow space between function identifier and application
|
185 | "no-ternary": 0, // disallow the use of ternary operators (off by default)
|
186 | "no-trailing-spaces": 0, // disallow trailing whitespace at the end of lines
|
187 | "no-underscore-dangle": 0, // disallow dangling underscores in identifiers
|
188 | "no-unneeded-ternary": 2, // disallow the use of Boolean literals in conditional expressions
|
189 | "object-curly-spacing": 0, // require or disallow padding inside curly braces
|
190 | "one-var": 0, // allow just one var statement per function (off by default)
|
191 | "operator-assignment": [2, "always"], // require assignment operator shorthand where possible or prohibit it entirely (off by default)
|
192 | "operator-linebreak": 0, // enforce operators to be placed before or after line breaks
|
193 | "padded-blocks": 0, // enforce padding within blocks (off by default)
|
194 | "quote-props": 2, // require quotes around object literal property names (off by default)
|
195 | "quotes": [2, "single"], // specify whether double or single quotes should be used
|
196 | "semi": [2, "always"], // require or disallow use of semicolons instead of ASI
|
197 | "semi-spacing": 2, // enforce spacing before and after semicolons
|
198 | "sort-vars": 0, // sort variables within the same declaration block (off by default)
|
199 | "space-after-keywords": 2, // require a space after certain keywords (off by default)
|
200 | "space-before-blocks": 2, // require or disallow space before blocks (off by default)
|
201 | "space-before-function-paren": 0, // require or disallow a space before function opening parenthesis
|
202 | "space-in-parens": 2, // require or disallow spaces inside parentheses (off by default)
|
203 | "space-infix-ops": 2, // require spaces around operators
|
204 | "space-return-throw-case": 2, // require a space after return, throw, and case
|
205 | "space-unary-ops": 2, // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
|
206 | "spaced-comment": 2, // require or disallow a space immediately following the // or /* in a comment
|
207 | "wrap-regex": 2, // require regex literals to be wrapped in parentheses (off by default)
|
208 |
|
209 |
|
210 | ////////// ECMAScript 6 //////////
|
211 |
|
212 | "no-var": 0, // require let or const instead of var (off by default)
|
213 |
|
214 |
|
215 | ////////// Legacy //////////
|
216 |
|
217 | "max-depth": 0, // specify the maximum depth that blocks can be nested (off by default)
|
218 | "max-len": 0, // specify the maximum length of a line in your program (off by default)
|
219 | "max-params": 0, // limits the number of parameters that can be used in the function declaration. (off by default)
|
220 | "max-statements": 0, // specify the maximum number of statement allowed in a function (off by default)
|
221 | "no-bitwise": 0, // disallow use of bitwise operators (off by default)
|
222 | "no-plusplus": 0 // disallow use of unary operators, ++ and -- (off by default)
|
223 | }
|
224 | }
|