-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
112 lines (112 loc) · 4.85 KB
/
.eslintrc.js
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
module.exports = {
env: {
browser: true,
jest: true,
},
/**
* Extend the Airbnb style guide.
* https://github.com/airbnb/javascript
* https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base
*/
extends: 'airbnb-base',
rules: {
/**
* Turn off requirement for new line at the end of the files.
*/
'eol-last': 'off',
/**
* Make file extensions in import statements required except for packages.
* https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
*/
'import/extensions': ['error', 'always', { ignorePackages: true }],
/**
* Use tabs for indentation instead of spaces.
* https://github.com/airbnb/javascript#whitespace--spaces
* https://eslint.org/docs/rules/indent
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/style.js#L120
*/
indent: ['error', 'tab'],
/**
* Allow assignment in conditional statements only if they're surrounded by parentheses.
* For instance:
*
* while ((node = nodeIterator.nextNode()) !== null) {
* // ...
* }
*
* https://eslint.org/docs/rules/no-cond-assign
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/errors.js#L20
*/
'no-cond-assign': ['error', 'except-parens'],
/**
* Allow the use of the `continue` statement.
* https://eslint.org/docs/rules/no-continue
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/style.js#L265
*/
'no-continue': 'off',
/**
* Allow unary operators.
* https://github.com/airbnb/javascript#variables--unary-increment-decrement
* https://eslint.org/docs/rules/no-plusplus
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/style.js#L319
*/
'no-plusplus': 'off',
/**
* The `no-restricted-syntax` is overwritten here to allow use of "for-of" loops.
* https://github.com/airbnb/javascript#iterators--nope
* https://eslint.org/docs/rules/no-restricted-syntax
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/style.js#L323
*/
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'LabeledStatement',
message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
/**
* Allow use of tabs.
* https://eslint.org/docs/rules/no-tabs
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/style.js#L347
*/
'no-tabs': 'off',
/**
* The `object-curly-newline` is overwritten here to allow the use of more properties in a
* single line.
* https://eslint.org/docs/rules/object-curly-newline
* https://github.com/airbnb/javascript/blob/fd0834764c8b991a807e6366181c1a3eddba240d/packages/eslint-config-airbnb-base/rules/style.js#L384
*/
'object-curly-newline': ['error', {
ObjectExpression: { minProperties: 8, multiline: true, consistent: true },
ObjectPattern: { minProperties: 8, multiline: true, consistent: true },
ImportDeclaration: { minProperties: 8, multiline: true, consistent: true },
ExportDeclaration: { minProperties: 8, multiline: true, consistent: true },
}],
/**
* Require all variable declarations **that are initialized** to have one `const` or `let`
* and be on its own line. Allow the use of one `const` or `let` to declare multiple
* **uninitialized** variables in a single line.
* https://github.com/airbnb/javascript#variables--one-const
* https://eslint.org/docs/rules/one-var
* https://eslint.org/docs/rules/one-var-declaration-per-line
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/style.js#L396
*/
'one-var': ['error', { initialized: 'never' }],
'one-var-declaration-per-line': ['error', 'initializations'],
/**
* Require a space when using dollar sign and curly braces in a template literal.
* https://github.com/airbnb/javascript#es6-template-literals
* https://eslint.org/docs/rules/template-curly-spacing
* https://github.com/airbnb/javascript/blob/cfe10c17d3f1df7325f8d40a4fcb2486254892f1/packages/eslint-config-airbnb-base/rules/es6.js#L171
*/
'template-curly-spacing': ['error', 'always'],
},
};