forked from tumblr/tumblr.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc
316 lines (297 loc) · 23 KB
/
.eslintrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
{
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
},
"parser": "espree",
"ecmaFeatures": {},
//
// http://eslint.org/docs/rules/
//
"rules": {
//
//
// Rules
//
//
// Rules in ESLint are divided into several categories to help you better understand their value. All rules are
// disabled by default. ESLint recommends some rules to catch common problems, and you can use these recommended
// rules by including `extends: "eslint:recommended"` in your configuration file. The rules that will be enabled
// when you inherit from `eslint:recommended` are indicated below as "(recommended)". For more information on how to
// configure rules and use `extends`, please see the [configuration documentation](../user-guide/configuring.md).
//
// Some rules are fixable using the `--fix` command line flag. Those rules are marked as "(fixable)" below.
// Currently these fixes are mostly limited only to whitespace fixes.
//
//
// Possible Errors
//
// The following rules point out areas where you might have made mistakes.
//
"comma-dangle": ["error", "always-multiline"], // disallow or enforce trailing commas (recommended)
"no-cond-assign": "error", // disallow assignment in conditional expressions (recommended)
"no-console": "error", // disallow use of `console` (recommended)
"no-constant-condition": "error", // disallow use of constant expressions in conditions (recommended)
"no-control-regex": "error", // disallow control characters in regular expressions (recommended)
"no-debugger": "error", // disallow use of `debugger` (recommended)
"no-dupe-args": "error", // disallow duplicate arguments in functions (recommended)
"no-dupe-keys": "error", // disallow duplicate keys when creating object literals (recommended)
"no-duplicate-case": "error", // disallow a duplicate case label. (recommended)
"no-empty": "error", // disallow empty block statements (recommended)
"no-empty-character-class": "error", // disallow the use of empty character classes in regular expressions (recommended)
"no-ex-assign": "error", // disallow assigning to the exception in a `catch` block (recommended)
"no-extra-boolean-cast": "error", // disallow double-negation boolean casts in a boolean context (recommended)
"no-extra-parens": "off", // disallow unnecessary parentheses
"no-extra-semi": "error", // disallow unnecessary semicolons (recommended) (fixable)
"no-func-assign": "error", // disallow overwriting functions written as function declarations (recommended)
"no-inner-declarations": "error", // disallow function or variable declarations in nested blocks (recommended)
"no-invalid-regexp": "error", // disallow invalid regular expression strings in the `RegExp` constructor (recommended)
"no-irregular-whitespace": "error", // disallow irregular whitespace outside of strings and comments (recommended)
"no-negated-in-lhs": "error", // disallow negation of the left operand of an `in` expression (recommended)
"no-obj-calls": "error", // disallow the use of object properties of the global object (`Math` and `JSON`) as functions (recommended)
"no-regex-spaces": "error", // disallow multiple spaces in a regular expression literal (recommended)
"no-sparse-arrays": "error", // disallow sparse arrays (recommended)
"no-unexpected-multiline": "error", // disallow code that looks like two expressions but is actually one (recommended)
"no-unreachable": "error", // disallow unreachable statements after a return, throw, continue, or break statement (recommended)
"use-isnan": "error", // disallow comparisons with the value `NaN` (recommended)
"valid-jsdoc": ["error", {"requireReturn": false}], // ensure JSDoc comments are valid
"valid-typeof": "error", // ensure results of typeof are compared against a valid string (recommended)
//
// Best Practices
//
// These are rules designed to prevent you from making mistakes. They either prescribe a better way of doing
// something or help you avoid footguns.
//
"accessor-pairs": "off", // enforce getter/setter pairs in objects
"array-callback-return": "off", // enforce return statements in callbacks of array's methods
"block-scoped-var": "off", // treat `var` statements as if they were block scoped
"complexity": ["off", 11], // specify the maximum cyclomatic complexity allowed in a program
"consistent-return": "off", // require `return` statements to either always or never specify values
"curly": "off", // specify curly brace conventions for all control statements
"default-case": "off", // require `default` case in `switch` statements
"dot-location": "off", // enforce consistent newlines before or after dots
"dot-notation": "off", // encourage use of dot notation whenever possible
"eqeqeq": "off", // require use of `===` and `!==`
"guard-for-in": "off", // ensure `for-in` loops have an `if` statement
"no-alert": "off", // disallow use of `alert`, `confirm`, and `prompt`
"no-caller": "off", // disallow use of `arguments.caller` or `arguments.callee`
"no-case-declarations": "error", // disallow lexical declarations in case clauses (recommended)
"no-div-regex": "off", // disallow division operators explicitly at beginning of regular expression
"no-else-return": "off", // disallow `else` after a `return` in an `if`
"no-empty-function": "off", // disallow use of empty functions
"no-empty-pattern": "error", // disallow use of empty destructuring patterns (recommended)
"no-eq-null": "off", // disallow comparisons to null without a type-checking operator
"no-eval": "off", // disallow use of `eval()`
"no-extend-native": "off", // disallow adding to native types
"no-extra-bind": "off", // disallow unnecessary function binding
"no-extra-label": "off", // disallow unnecessary labels
"no-fallthrough": "error", // disallow fallthrough of `case` statements (recommended)
"no-floating-decimal": "off", // disallow the use of leading or trailing decimal points in numeric literals
"no-implicit-coercion": "off", // disallow the type conversions with shorter notations
"no-implicit-globals": "off", // disallow `var` and named functions in global scope
"no-implied-eval": "off", // disallow use of `eval()`-like methods
"no-invalid-this": "off", // disallow `this` keywords outside of classes or class-like objects
"no-iterator": "off", // disallow usage of `__iterator__` property
"no-labels": "off", // disallow use of labeled statements
"no-lone-blocks": "off", // disallow unnecessary nested blocks
"no-loop-func": "off", // disallow creation of functions within loops
"no-magic-numbers": "off", // disallow the use of magic numbers
"no-multi-spaces": "error", // disallow use of multiple spaces (fixable)
"no-multi-str": "off", // disallow use of multiline strings
"no-native-reassign": "off", // disallow reassignments of native objects
"no-new": "off", // disallow use of the `new` operator when not part of an assignment or comparison
"no-new-func": "off", // disallow use of new operator for `Function` object
"no-new-wrappers": "off", // disallow creating new instances of `String`,`Number`, and `Boolean`
"no-octal": "error", // disallow use of octal literals (recommended)
"no-octal-escape": "off", // disallow use of octal escape sequences in string literals, such as `var foo = "Copyright \251";`
"no-param-reassign": "off", // disallow reassignment of function parameters
"no-proto": "off", // disallow usage of `__proto__` property
"no-redeclare": "error", // disallow declaring the same variable more than once (recommended)
"no-return-assign": "off", // disallow use of assignment in `return` statement
"no-script-url": "off", // disallow use of `javascript:` urls.
"no-self-assign": "error", // disallow assignments where both sides are exactly the same (recommended)
"no-self-compare": "off", // disallow comparisons where both sides are exactly the same
"no-sequences": "off", // disallow use of the comma operator
"no-throw-literal": "off", // restrict what can be thrown as an exception
"no-unmodified-loop-condition": "off", // disallow unmodified conditions of loops
"no-unused-expressions": "off", // disallow usage of expressions in statement position
"no-unused-labels": "error", // disallow unused labels (recommended)
"no-useless-call": "off", // disallow unnecessary `.call()` and `.apply()`
"no-useless-concat": "off", // disallow unnecessary concatenation of literals or template literals
"no-useless-escape": "off", // disallow unnecessary usage of escape character
"no-void": "off", // disallow use of the `void` operator
"no-warning-comments": "off", // disallow usage of configurable warning terms in comments: e.g. `TODO` or `FIXME`
"no-with": "off", // disallow use of the `with` statement
"radix": "off", // require use of the second argument for `parseInt()`
"vars-on-top": "off", // require declaration of all vars at the top of their containing scope
"wrap-iife": "off", // require immediate function invocation to be wrapped in parentheses
"yoda": "off", // require or disallow Yoda conditions
//
// Strict Mode
//
// These rules relate to using strict mode and strict mode directives.
//
"strict": "off", // require effective use of strict mode directives
//
// Variables
//
// These rules have to do with variable declarations.
//
"init-declarations": "off", // enforce or disallow variable initializations at definition
"no-catch-shadow": "off", // disallow the catch clause parameter name being the same as a variable in the outer scope
"no-delete-var": "error", // disallow deletion of variables (recommended)
"no-label-var": "off", // disallow labels that share a name with a variable
"no-restricted-globals": "off", // restrict usage of specified global variables
"no-shadow": "off", // disallow declaration of variables already declared in the outer scope
"no-shadow-restricted-names": "off", // disallow shadowing of names such as `arguments`
"no-undef": "error", // disallow use of undeclared variables unless mentioned in a `/*global */` block (recommended)
"no-undef-init": "off", // disallow use of undefined when initializing variables
"no-undefined": "off", // disallow use of `undefined` variable
"no-unused-vars": ["error", {"vars": "all", "args": "none"}], // disallow declaration of variables that are not used in the code (recommended)
"no-use-before-define": "off", // disallow use of variables before they are defined
//
// Node.js and CommonJS
//
// These rules are specific to JavaScript running on Node.js or using CommonJS in the browser.
//
"callback-return": "off", // enforce `return` after a callback
"global-require": "off", // enforce `require()` on top-level module scope
"handle-callback-err": "off", // enforce error handling in callbacks
"no-mixed-requires": "off", // disallow mixing regular variable and require declarations
"no-new-require": "off", // disallow use of `new` operator with the `require` function
"no-path-concat": "off", // disallow string concatenation with `__dirname` and `__filename`
"no-process-env": "off", // disallow use of `process.env`
"no-process-exit": "off", // disallow `process.exit()`
"no-restricted-modules": "off", // restrict usage of specified modules when loaded by `require` function
"no-sync": "off", // disallow use of synchronous methods
//
// Stylistic Issues
//
// These rules are purely matters of style and are quite subjective.
//
"array-bracket-spacing": ["error", "never"], // enforce spacing inside array brackets (fixable)
"block-spacing": "off", // disallow or enforce spaces inside of single line blocks (fixable)
"brace-style": ["error", "1tbs", {"allowSingleLine": false}], // enforce one true brace style
"camelcase": "off", // require camel case names
"comma-spacing": ["error", {"before": false, "after": true}], // enforce spacing before and after comma (fixable)
"comma-style": ["error", "last"], // enforce one true comma style
"computed-property-spacing": "off", // require or disallow padding inside computed properties (fixable)
"consistent-this": "off", // enforce consistent naming when capturing the current execution context
"eol-last": ["error"], // enforce newline at the end of file, with no multiple empty lines (fixable)
"func-names": "off", // require function expressions to have a name
"func-style": "off", // enforce use of function declarations or expressions
"id-blacklist": "off", // disallow certain identifiers to prevent them being used
"id-length": "off", // enforce minimum and maximum identifier lengths (variable names, property names etc.)
"id-match": "off", // require identifiers to match the provided regular expression
"indent": ["error", 4, {"SwitchCase": 1}], // specify tab or space width for your code (fixable)
"jsx-quotes": "off", // specify whether double or single quotes should be used in JSX attributes (fixable)
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}], // enforce spacing between keys and values in object literal properties
"keyword-spacing": ["error", {"before": true, "after": true}], // enforce spacing before and after keywords
"linebreak-style": ["error", "unix"], // enforce linebreak style (fixable)
"lines-around-comment": "off", // enforce empty lines around comments
"max-depth": "off", // specify the maximum depth that blocks can be nested
"max-len": "off", // specify the maximum length of a line in your program
"max-nested-callbacks": "off", // specify the maximum depth callbacks can be nested
"max-params": "off", // specify the number of parameters that can be used in the function declaration
"max-statements": "off", // specify the maximum number of statement allowed in a function
"max-statements-per-line": "off", // specify the maximum number of statements allowed per line
"new-cap": "off", // require a capital letter for constructors
"new-parens": "error", // disallow the omission of parentheses when invoking a constructor with no arguments
"newline-after-var": "off", // require or disallow an empty newline after variable declarations
"newline-before-return": "off", // require newline before `return` statement
"newline-per-chained-call": "off", // enforce newline after each call when chaining the calls
"no-array-constructor": ["error"], // disallow use of the `Array` constructor
"no-bitwise": "off", // disallow use of bitwise operators
"no-continue": "off", // disallow use of the `continue` statement
"no-inline-comments": "off", // disallow comments inline after code
"no-lonely-if": "off", // disallow `if` as the only statement in an `else` block
"no-mixed-spaces-and-tabs": "error", // disallow mixed spaces and tabs for indentation (recommended)
"no-multiple-empty-lines": "off", // disallow multiple empty lines
"no-negated-condition": "off", // disallow negated conditions
"no-nested-ternary": "off", // disallow nested ternary expressions
"no-new-object": "off", // disallow the use of the `Object` constructor
"no-plusplus": "off", // disallow use of unary operators, `++` and `--`
"no-restricted-syntax": "off", // disallow use of certain syntax in code
"no-spaced-func": "off", // disallow space between function identifier and application (fixable)
"no-ternary": "off", // disallow the use of ternary operators
"no-trailing-spaces": "error", // disallow trailing whitespace at the end of lines (fixable)
"no-underscore-dangle": "off", // disallow dangling underscores in identifiers
"no-unneeded-ternary": "off", // disallow the use of ternary operators when a simpler alternative exists
"no-whitespace-before-property": "off", // disallow whitespace before properties
"object-curly-spacing": ["off", "never"], // require or disallow padding inside curly braces (fixable)
"one-var": "off", // require or disallow one variable declaration per function
"one-var-declaration-per-line": "off", // require or disallow an newline around variable declarations
"operator-assignment": "off", // require assignment operator shorthand where possible or prohibit it entirely
"operator-linebreak": "off", // enforce operators to be placed before or after line breaks
"padded-blocks": "off", // enforce padding within blocks
"quote-props": ["error", "as-needed", {"keywords": true}], // require quotes around object literal property names
"quotes": ["error", "single", "avoid-escape"], // specify whether backticks, double or single quotes should be used (fixable)
"require-jsdoc": "off", // require JSDoc comment
"semi": ["error", "always"], // require or disallow use of semicolons instead of ASI (fixable)
"semi-spacing": "error", // enforce spacing before and after semicolons (fixable)
"sort-imports": "off", // enforce sorting import declarations within module
"sort-vars": "off", // enforce sorting variables within the same declaration block
"space-before-blocks": ["error", "always"], // require or disallow a space before blocks (fixable)
"space-before-function-paren": ["error", "never"], // require or disallow a space before function opening parenthesis (fixable)
"space-in-parens": ["error", "never"], // require or disallow spaces inside parentheses (fixable)
"space-infix-ops": "error", // require spaces around operators (fixable)
"space-unary-ops": ["error", {"words": true, "nonwords": false}], // require or disallow spaces before/after unary operators (fixable)
"spaced-comment": ["error", "always", {"markers": ["!"]}], // require or disallow a space immediately following the `//` or `/*` in a comment (fixable)
"wrap-regex": "off", // require regex literals to be wrapped in parentheses
//
// ECMAScript 6
//
// These rules are only relevant to ES6 environments.
//
"arrow-body-style": "off", // require braces in arrow function body
"arrow-parens": "off", // require parens in arrow function arguments
"arrow-spacing": "off", // require space before/after arrow function's arrow (fixable)
"constructor-super": "error", // ensure calling of `super()` in constructors (recommended)
"generator-star-spacing": "off", // enforce spacing around the `*` in generator functions (fixable)
"no-class-assign": "error", // disallow modifying variables of class declarations (recommended)
"no-confusing-arrow": "off", // disallow arrow functions where they could be confused with comparisons
"no-const-assign": "error", // disallow modifying variables that are declared using `const` (recommended)
"no-dupe-class-members": "error", // disallow duplicate name in class members (recommended)
"no-duplicate-imports": "off", // disallow duplicate module imports
"no-new-symbol": "error", // disallow use of the `new` operator with the `Symbol` object (recommended)
"no-restricted-imports": "off", // restrict usage of specified modules when loaded by `import` declaration
"no-this-before-super": "error", // disallow use of `this`/`super` before calling `super()` in constructors (recommended)
"no-useless-constructor": "off", // disallow unnecessary constructor
"no-var": "off", // require `let` or `const` instead of `var`
"object-shorthand": "off", // require method and property shorthand syntax for object literals
"prefer-arrow-callback": "off", // suggest using arrow functions as callbacks
"prefer-const": "off", // suggest using `const` declaration for variables that are never reassigned after declared
"prefer-reflect": "off", // suggest using Reflect methods where applicable
"prefer-rest-params": "off", // suggest using the rest parameters instead of `arguments`
"prefer-spread": "off", // suggest using the spread operator instead of `.apply()`
"prefer-template": "off", // suggest using template literals instead of strings concatenation
"require-yield": "off", // disallow generator functions that do not have `yield`
"template-curly-spacing": "off", // enforce spacing around embedded expressions of template strings (fixable)
"yield-star-spacing": "off", // enforce spacing around the `*` in `yield*` expressions (fixable)
//
//
// Removed
//
// These rules existed in a previous version of ESLint but have since been replaced by newer rules.
//
"generator-star": 0, // enforce the position of the `*` in generator functions (replaced by [generator-star-spacing](generator-star-spacing.md))
"global-strict": 0, // require or disallow the `"use strict"` pragma in the global scope (replaced by [strict](strict.md))
"no-arrow-condition": 0, // disallow arrow functions where a condition is expected (replaced by [no-confusing-arrow](no-confusing-arrow.md) and [no-constant-condition](no-constant-condition.md))
"no-comma-dangle": 0, // disallow trailing commas in object literals (replaced by [comma-dangle](comma-dangle.md))
"no-empty-class": 0, // disallow the use of empty character classes in regular expressions (replaced by [no-empty-character-class](no-empty-character-class.md))
"no-empty-label": 0, // disallow use of labels for anything other than loops and switches (replaced by [no-labels](no-labels.md))
"no-extra-strict": 0, // disallow unnecessary use of `"use strict";` when already in strict mode (replaced by [strict](strict.md))
"no-reserved-keys": 0, // disallow reserved words being used as object literal keys (replaced by [quote-props](quote-props.md))
"no-space-before-semi": 0, // disallow space before semicolon (replaced by [semi-spacing](semi-spacing.md))
"no-wrap-func": 0, // disallow wrapping of non-IIFE statements in parens (replaced by [no-extra-parens](no-extra-parens.md))
"space-after-function-name": 0, // require a space after function names (replaced by [space-before-function-paren](space-before-function-paren.md))
"space-after-keywords": 0, // require a space after certain keywords (fixable) (replaced by [keyword-spacing](keyword-spacing.md))
"space-before-function-parentheses": 0, // require or disallow space before function parentheses (replaced by [space-before-function-paren](space-before-function-paren.md))
"space-before-keywords": 0, // require a space before certain keywords (fixable) (replaced by [keyword-spacing](keyword-spacing.md))
"space-in-brackets": 0, // require or disallow spaces inside brackets (replaced by [object-curly-spacing](object-curly-spacing.md) and [array-bracket-spacing](array-bracket-spacing.md))
"space-return-throw-case": 0, // require a space after `return`, `throw`, and `case` (fixable) (replaced by [keyword-spacing](keyword-spacing.md))
"space-unary-word-ops": 0, // require or disallow spaces before/after unary operators (replaced by [space-unary-ops](space-unary-ops.md))
"spaced-line-comment": 0 // require or disallow a space immediately following the `//` in a line comment (replaced by [spaced-comment](spaced-comment.md))
}
}