-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.eslintrc
82 lines (71 loc) · 3.03 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
{
"parser": "@typescript-eslint/parser",
"env": {
"node": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"rules": {
"@typescript-eslint/indent": ["error", 2],
// Style
"quotes": ["error", "single", { "avoidEscape": true }],
"comma-dangle": ["error", "always-multiline"], // ensures clean diffs, see https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
"comma-spacing": ["error", { "before": false, "after": true }], // space after, no space before
"no-multi-spaces": ["error", { "ignoreEOLComments": false }], // no multi spaces
"array-bracket-spacing": ["error", "never"], // [1, 2, 3]
"array-bracket-newline": ["error", "consistent"], // enforce consistent line breaks between brackets
"object-curly-spacing": ["error", "always"], // { key: 'value' }
"object-curly-newline": [
"error",
{ "multiline": true, "consistent": true }
], // enforce consistent line breaks between braces
"object-property-newline": [
"error",
{ "allowAllPropertiesOnSameLine": true }
], // enforce "same line" or "multiple line" on object properties
"keyword-spacing": ["error"], // require a space before & after keywords
"brace-style": ["error", "1tbs", { "allowSingleLine": true }], // enforce one true brace style
"space-before-blocks": "error", // require space before blocks
"curly": ["error", "multi-line", "consistent"], // require curly braces for multiline control statements
// Cannot import from the same module twice
"no-duplicate-imports": ["error"],
// Cannot shadow names
"no-shadow": ["off"],
"@typescript-eslint/no-shadow": ["error"],
// Required spacing in property declarations (copied from TSLint, defaults are good)
"key-spacing": ["error"],
// Require semicolons
"semi": ["error", "always"],
// Don't unnecessarily quote properties
"quote-props": ["error", "consistent-as-needed"],
// No multiple empty lines
"no-multiple-empty-lines": ["error"],
// Max line lengths
"max-len": [
"error",
{
"code": 150,
"ignoreUrls": true, // Most common reason to disable it
"ignoreStrings": true, // These are not fantastic but necessary for error messages
"ignoreTemplateLiterals": true,
"ignoreComments": true,
"ignoreRegExpLiterals": true
}
],
// One of the easiest mistakes to make
"@typescript-eslint/no-floating-promises": ["error"],
// Make sure that inside try/catch blocks, promises are 'return await'ed
// (must disable the base rule as it can report incorrect errors)
"no-return-await": "off",
"@typescript-eslint/return-await": "error",
// Useless diff results
"no-trailing-spaces": ["error"],
// Must use foo.bar instead of foo['bar'] if possible
"dot-notation": ["error"]
}
}