-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
96 lines (87 loc) · 3.61 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
module.exports = {
root: true,
parser: 'babel-eslint',
parserOptions: {
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true
},
plugins: [
'json',
'promise',
'html'
],
// add your custom rules here
rules: {
// allow debugger during development
'no-debugger':
process.env.NODE_ENV === "production" ? 2 : 0,
'prefer-const': 'error',
'one-var': ['off'],
'no-var': 'error',
'no-return-assign': ['error', 'except-parens'],
//'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'quote-props': ['error', 'as-needed'],
curly: ['off', 'multi-or-nest', 'consistent'],
'padding-line-between-statements': [
'off'
],
'promise/always-return': 'off',
'promise/no-return-wrap': 'error',
'promise/param-names': 'error',
'promise/catch-or-return': 'error',
'promise/no-new-statics': 'error',
'promise/no-return-in-finally': 'error'
},
settings: {
},
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: 'typescript-eslint-parser',
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
plugins: ['typescript'],
rules: {
// these are off because TypeScript handles these, and ESLint otherwise gets false positives on these.
// See: https://github.com/eslint/typescript-eslint-parser/issues/208
'no-undef': 0,
'no-unused-vars': 0,
// typescript-specific rules
'typescript/adjacent-overload-signatures': 'off', // — Require that member overloads be consecutive
'typescript/class-name-casing': 'error', // — Require PascalCased class and interface names (class-name from TSLint)
'typescript/explicit-function-return-type': [
'error',
{
allowExpressions: true
}
], // — Require explicit return types on functions and class methods
// 'typescript/explicit-member-accessibility': , // — Require explicit accessibility modifiers on class properties and methods (member-access from TSLint)
// 'typescript/interface-name-prefix': , // — Require that interface names be prefixed with I (interface-name from TSLint)
'typescript/member-delimiter-style': [
'off',
{
delimiter: 'none',
requireLast: true,
ignoreSingleLine: true
}
],
'typescript/no-angle-bracket-type-assertion': 'error', // — Enforces the use of as Type assertions instead of <Type> assertions (no-angle-bracket-type-assertion from TSLint)
'typescript/no-array-constructor': 'error', // — Disallow generic Array constructors
'typescript/no-explicit-any': 'off', // — Disallow usage of the any type (no-any from TSLint)
'typescript/no-inferrable-types': 'off', // — Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean. (no-inferrable-types from TSLint)
'typescript/no-namespace': 'off', // — Disallow the use of custom TypeScript modules and namespaces
'typescript/no-triple-slash-reference': 'off', // — Disallow /// <reference path="" /> comments (no-reference from TSLint)
'typescript/no-unused-vars': 'error', // — Prevent TypeScript-specific constructs from being erroneously flagged as unused
'typescript/no-var-requires': 'off', // — Disallows the use of require statements except in import statements (no-var-requires from TSLint)
'typescript/type-annotation-spacing': ['off', {}] // — Require consistent spacing around type annotations
}
}
]
}