/
.eslintrc
148 lines (124 loc) · 4.35 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
{
"extends": [
// Only import some AirBNB rules
// https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base/rules
"airbnb-base"
],
// This is the root eslint file.
// We should ONLY be using eslint rules specific to this project.
"root": true,
// All source code is at least ES6 friendly.
// Note that this is not the case in the demoapp example pages,
// which are ES5 compatible and not compiled.
"env": {
"es6": true
},
"ignorePatterns": ["*e2e-spec.js", "*e2e-test.js"],
// Need `ecmaVersion: 9` for:
// - [Object spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals)
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"requireConfigFile": false
},
// Add ES6 import plugins
"plugins": [
"import"
],
"rules": {
// require trailing commas in multiline object literals
"comma-dangle": ["off", {
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"no-await-in-loop": "off",
// Re-enable anonymous/unnamed functions
// https://eslint.org/docs/rules/func-names
"func-names": "off",
// Require modules with a single export to use a default export
// Will ignore because of https://medium.com/@timoxley/named-exports-as-the-default-export-api-670b1b554f65
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
"import/prefer-default-export": "off",
// specify the maximum length of a line in your program
// https://eslint.org/docs/rules/max-len
"max-len": ["error", {
"code": 120,
"comments": 350,
"ignoreUrls": true,
"ignoreComments": false,
"ignoreRegExpLiterals": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}],
// disallow use of chained assignment expressions
// https://eslint.org/docs/rules/no-multi-assign
"no-multi-assign": ["warn"],
// disallow multiple empty lines and only one newline at the end
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }],
// Don"t allow paramter reassignment
"no-param-reassign": ["off", {
"props": true
}],
// disallow use of unary operators, ++ and --
// https://eslint.org/docs/rules/no-plusplus
"no-plusplus": "off",
// Allow usage of certain Global values
"no-restricted-globals": ["warn", {
"name": "isNaN",
"message": "Make sure to explore using `Number.isNaN()` instead."
}],
// Ignore usage of certain properties:
// - Math.pow (not really sure why AirBNB doesn"t allow this)
"no-restricted-properties": ["off", {
"object": "Math",
"property": "pow"
}],
// set "no-trailing-spaces" to only a warning (this shouldn"t fail builds)
"no-trailing-spaces": ["warn"],
// set "no-underscore-dangle" to only a warning (also shouldn"t fail builds)
"no-underscore-dangle": ["warn"],
// enforce line breaks between braces
// https://eslint.org/docs/rules/object-curly-newline
"object-curly-newline": ["error", {
"ObjectExpression": {
"minProperties": 8,
"multiline": true,
"consistent": true
},
"ObjectPattern": {
"minProperties": 8,
"multiline": true,
"consistent": true
}
}],
// Don"t enforce usage of arrow functions, but warn about them.
// https://eslint.org/docs/rules/prefer-arrow-callback
"prefer-arrow-callback": ["warn", {}],
// Prefer destructuring from arrays and objects
// https://eslint.org/docs/rules/prefer-destructuring
"prefer-destructuring": ["off", {
"VariableDeclarator": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": true,
"object": true
}
}, {
"enforceForRenamedProperties": false
}],
// Don"t enforce extra brackets
// https://eslint.org/docs/2.0.0/rules/arrow-parensextra
"arrow-parens": ["error", "as-needed", { "requireForBlockBody": true }],
// Have operators on same line
// https://eslint.org/docs/rules/operator-linebreak
"operator-linebreak": ["error", "after"],
// Allow js in imports
"import/extensions": ["off"]
}
}