-
Notifications
You must be signed in to change notification settings - Fork 10
/
.eslintrc.js
110 lines (103 loc) · 4.9 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
module.exports = {
'extends': ['airbnb-base', 'plugin:@typescript-eslint/recommended'],
'parserOptions': {
'project': './tsconfig.json'
},
'settings': {
// Some imports may be resolved via webpack aliases
'import/resolver': {
'webpack': {
'config': 'webpack.common.js'
}
}
},
'rules': {
// Broken
// This rule frequently throws up false positives with subclasses https://github.com/typescript-eslint/typescript-eslint/issues/52
'class-methods-use-this': 'off',
// Same with this one https://github.com/typescript-eslint/typescript-eslint/issues/586
'@typescript-eslint/no-unused-vars': 'off',
// Prefer typescript-eslint version
'semi': 'off',
'@typescript-eslint/semi': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
// Handled by typescript
'no-dupe-class-members': 'off',
'no-undef': 'off',
'consistent-return': 'off',
// These aren't really a big issue and used well keep our code cleaner
'no-bitwise': 'off',
'no-continue': 'off',
'no-plusplus': 'off',
'no-underscore-dangle': 'off',
'max-classes-per-file': 'off',
'@typescript-eslint/no-empty-function': 'off',
'no-fallthrough': ['error', { "commentPattern": "break[\\s\\w]*omitted" }],
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', {'classes': false, 'typedefs': false, 'ignoreTypeReferences': true}],
// NOTE: Some are public but marked `/* internal */`, awaiting https://github.com/Microsoft/TypeScript/issues/5228
'@typescript-eslint/explicit-member-accessibility': ['warn', {
'overrides': {'constructors': 'no-public'}
}],
'@typescript-eslint/no-angle-bracket-type-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': ['off', {
'allowTypedFunctionExpressions': true
}],
'no-constant-condition': ['error', { 'checkLoops': false }],
// We like using for..of statements, so we have to redefine with everything else via the airbnb config (https://github.com/airbnb/javascript/blob/a510095acf20e3d96a94e6d0d0b26cfac71d2c7f/packages/eslint-config-airbnb-base/rules/style.js#L334)
'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.',
},
],
// Stylistic preference
'comma-dangle': ['error', 'never'],
'indent': 'off',
'@typescript-eslint/indent': ['error', 4],
//'quotes': ['error', 'single'],
'max-len': ['error', {
'code': 120,
'ignoreTemplateLiterals': true,
'ignoreRegExpLiterals': true,
'ignoreUrls': true
}],
'lines-between-class-members': ['error', 'always', {'exceptAfterSingleLine': true}],
'object-curly-spacing': ['error', 'never'],
// This can be more readable depending on the situation
'no-else-return': 'off',
// This would be great if it could pick up when we reassign multiple properties, but it's all sorts of
// painful/less readable in a large number of of cases
'prefer-destructuring': 'off',
// In adition to stylistic preference, also prevents issues with the TS typechecker
'@typescript-eslint/no-inferrable-types': ['error', {
"ignoreParameters": true,
"ignoreProperties": true,
}],
// Stuff to review, likely due to impending code changes
// This isn't generally great practice, but a couple portions of our code benefit from this.
'no-cond-assign': ['error', 'except-parens'],
// At least until the dynamic content changes to interfaces
'dot-notation': 'off',
// bring it on
'@typescript-eslint/no-explicit-any': 2,
// Outparams are used in some places to reduce allocations, however it'd be nice to have in general...
// Should probably reconfigure with ignorePropertyModificationsFor
'no-param-reassign': 'off',
// It would be good to turn this on, but we'll leave that for v2
'@typescript-eslint/explicit-module-boundary-types': 'off',
// this became a problem recently because a default changed
'import/extensions': ['error', 'never'],
// typescript-eslint changed some stuff, again we'll reenable in v2
'camelcase': 'off'
}
};