-
Notifications
You must be signed in to change notification settings - Fork 27
/
.eslintrc
101 lines (92 loc) · 3.58 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
{
"root": true,
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
},
"sourceType": "module"
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"extends": ["airbnb"],
"rules": {
// Copy most recent airbnb-style for max-len rule. eslint we bumped to
// to take advantage of the `ignoreRegExpLiterals` rule, but airbnb style
// itself was not bumped because of many new rules that break existing code.
// Line length is currently a warning to not break old code
"max-len": ["warn", 100, 2, {
ignoreUrls: true,
ignoreComments: false,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
}],
// Allow arguments in functions to be unused
// This allows us to specify that a function will be called with arguments
// even though we do not need it, e.g. in Promise (resolve, reject),
// onEvent(event), catch(error), etc.
"no-unused-vars": ["error", { vars: "local", args: "none" }],
// Warnings for things that are not easily fixable now
"react/jsx-filename-extension": "warn",
"react/prefer-stateless-function": "warn",
"react/no-array-index-key": "warn",
"import/prefer-default-export": "warn",
// This is disallowed for good reasons, but unfortunately too much of our
// code relies explicitly on this behavior to set properties on an object
// referred to by an outer function (most notably CodeMirror state)
"no-param-reassign": "warn",
// Allow class functions to not use `this`
"class-methods-use-this": "warn",
// Allow unary operators in the afterthought of a for loop
// Not sure why Airbnb disallows this
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
// Allow non-interactive DOM elements to have interactive handlers. This is
// now a warning as a reminder that another element might be better, but
// we will not enforce it.
"jsx-a11y/no-static-element-interactions": "warn",
// Ignores comma-dangle for function arguments, as it breaks parsing and it
// behaves strangely if arguments are JSX
"comma-dangle": ["error", {
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "ignore",
}],
// Remove `ForOfSyntax`. Some things are iterators.
'no-restricted-syntax': [
'error',
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
// Allow optional dependencies (like electron)
// Do not override devDependency array (so this is copied)
'import/no-extraneous-dependencies': ['error', {
devDependencies: [
'test/**', // tape, common npm pattern
'tests/**', // also common npm pattern
'spec/**', // mocha, rspec-like pattern
'**/__tests__/**', // jest pattern
'test.js', // repos with a single test file
'test-*.js', // repos with multiple top-level test files
'**/*.test.js', // tests where the extension denotes that it is a test
'**/*.spec.js', // tests where the extension denotes that it is a test
'**/webpack.config.js', // webpack config
'**/webpack.config.*.js', // webpack config
'**/rollup.config.js', // rollup config
'**/rollup.config.*.js', // rollup config
'**/gulpfile.js', // gulp config
'**/gulpfile.*.js', // gulp config
'**/Gruntfile', // grunt config
],
optionalDependencies: true,
}],
}
}