-
Notifications
You must be signed in to change notification settings - Fork 5
/
.eslintrc.js
75 lines (75 loc) · 2.75 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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
// allows imports
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react'],
extends: [
'plugin:@typescript-eslint/recommended',
// turn on eslint-plugin-prettier and eslint-config-prettier
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
rules: {
'arrow-body-style': ['warn', 'as-needed'],
// curly braces for if, else etc.
curly: ['error', 'multi-line'],
'default-case': ['error'],
eqeqeq: ['error', 'smart'],
// for...in will normally include properties in prototype chain, require if
'guard-for-in': ['error'],
// I don't think we even use labels
'no-extra-label': ['error'],
// not sure about this, but replaces tslint's `no-arg` rule
'no-caller': ['error'],
// transfered from tslint's `no-conditional-assignment` rule
'no-cond-assign': ['error'],
'no-debugger': ['error'],
// similar to tslint's `no-construct` rule
'no-new-wrappers': ['error'],
// replacement for `no-string-throw`
'no-throw-literal': ['error'],
'no-unused-expressions': ['error'],
'no-var': ['error'],
// this isn't a tslint thing, but have copied over
'new-parens': ['error'],
'object-shorthand': ['error'],
'prefer-arrow-callback': ['error'],
'prefer-const': ['error'],
semi: ['error', 'never'],
'use-isnan': ['error'],
'@typescript-eslint/array-type': ['error', 'array-simple'],
'@typescript-eslint/ban-types': [
'error',
{
types: {
Object: 'Use {} instead.',
String: "Use 'string' instead.",
Number: "Use 'number' instead.",
Boolean: "Use 'boolean' instead.",
},
},
],
'react/jsx-uses-vars': ['warn'],
// PascalCase for classes
'@typescript-eslint/class-name-casing': ['error'],
// don't prefix interface names with 'I'
'@typescript-eslint/interface-name-prefix': ['error', 'never'],
// don't conflict <Types> and JSX
'@typescript-eslint/no-angle-bracket-type-assertion': ['error'],
// lose out on typing benefits with any
'@typescript-eslint/no-explicit-any': ['error'],
'@typescript-eslint/no-empty-interface': ['off'],
'@typescript-eslint/no-inferrable-types': ['error'],
// namespaces and modules are outdated, use ES6 style
'@typescript-eslint/no-namespace': ['error'],
// use ES6-style imports instead
'@typescript-eslint/no-triple-slash-reference': ['error'],
'@typescript-eslint/no-var-requires': ['off'],
'@typescript-eslint/no-use-before-define': ['off'],
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/explicit-member-accessibility': ['off'],
},
}