-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
105 lines (80 loc) · 4.06 KB
/
.eslintrc.json
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
{
// My eslint.json for typescript
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
// For global install of eslint:
// "project": "tsconfig.json"
// "tsconfigRootDir": "c:/dev/gcpAdmin/functions/" // otherwise it looks for it in global folder (since I'm using global eslint)
// https://github.com/typescript-eslint/typescript-eslint/issues/251 (see my comment)
},
"plugins": ["@typescript-eslint"],
"env" : {
"node": true
},
"extends": [
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.json
"plugin:@typescript-eslint/recommended"
// Above is the simpler group; the next one are separate only because they require processing (slower)
// "plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
// Copied from my JS eslint.
"max-len" : ["warn", {
"code": 120,
"comments": 120,
"ignoreTrailingComments": true,
"ignoreUrls": true
} ], // eslint def = 80, but airbnb = 100
// To change indent you must disable the base rule as it can report incorrect errors
// "indent": "off",
// "@typescript-eslint/indent": ["warn", 2],
// My rules selection is based on info here
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
// As of 2019-03-21
// --- Rules included in Recommended config ---
"@typescript-eslint/no-use-before-define": "off",
// "@typescript/no-use-before-define": ["error", {"functions": false, "typedefs": false}]
"@typescript-eslint/no-explicit-any": "off",
// explicit-member-accessibility - included in recommended (as error).
// Should I turn this off (and just allow lots of defaulting to 'public')?
"@typescript-eslint/explicit-member-accessibility": "warn", // default appears to be "error"
// --- Rules not included in Recommended config ---
"@typescript-eslint/no-for-in-array": "warn",
"@typescript-eslint/no-this-alias": "warn",
// Type aliasing is an advanced TS technique; I'm not sure about this one.
"@typescript-eslint/no-type-alias": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "warn",
// Not sure
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
"@typescript-eslint/unified-signatures": "warn",
// I can't get the configuration right. Wait until eslint-typescript has better documentation.
/*
// Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '{ default: [ true, { order: [Array], alphabetize: false } ] }
// Member Ordering
// Use Member group types (with scope, ignoring accessibility)
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-ordering.md#member-group-types-with-scope-ignoring-accessibility
"@typescript-eslint/member-ordering": { "default" :
[ "warn", { "order" : [
// Fields
"static-field", // = ['public-static-field', 'protected-static-field', 'private-static-field'])
"instance-field", // = ['public-instance-field', 'protected-instance-field', 'private-instance-field'])
// Constructors
"constructor", // = ['public-constructor', 'protected-constructor', 'private-constructor'])
// Methods
"static-method", // = ['public-static-method', 'protected-static-method', 'private-static-method'])
"instance-method" // = ['public-instance-method', 'protected-instance-method', 'private-instance-method']
],
"alphabetize": false
}
] }
*/
// -- Relax some rules during development phase
"@typescript-eslint/no-unused-vars" : "warn",
"@typescript-eslint/no-inferrable-types" : "warn", // set to error in 'recommended' plugin.
"prefer-const" : "warn",
"no-multiple-empty-lines" : "warn"
}
}