@@ -16,15 +16,65 @@ module.exports = {
16
16
"plugin:@typescript-eslint/strict" ,
17
17
] ,
18
18
rules : {
19
- semi : "off" , // have to disable eslint's core semicolon rules before enabling typescript-eslint's
19
+ // require semi-colons via @typescript-eslint
20
+ semi : "off" ,
20
21
"@typescript-eslint/semi" : "error" ,
21
22
"@typescript-eslint/member-delimiter-style" : "error" ,
22
- quotes : [ "error" , "double" , { "avoidEscape" : true } ] ,
23
+
24
+ // 2 space indentation, allow anything for switch statements and template strings
25
+ indent : "off" , // disable eslint's core indent rule
26
+ "@typescript-eslint/indent" : [ "error" , 2 , {
27
+ SwitchCase : 1 ,
28
+ ignoredNodes : [ "TemplateLiteral" ] ,
29
+ } ] ,
30
+
31
+ // allow multiple spaces for comments after a line, property values, and variable declarations
32
+ // these are here to allow for aligning blocks
33
+ "no-multi-spaces" : [ "error" , {
34
+ ignoreEOLComments : true ,
35
+ exceptions : {
36
+ Property : true ,
37
+ VariableDeclarator : true ,
38
+ } ,
39
+ } ] ,
40
+
41
+ // don't allow trailing spaces
42
+ "no-trailing-spaces" : "error" ,
43
+
44
+ // only allow whitespace before property access when chaining on new lines
45
+ "no-whitespace-before-property" : "error" ,
46
+
47
+ // require that dots for property access are on the same line as the property
48
+ "dot-location" : [ "error" , "property" ] ,
49
+
50
+ // require no spaces around parens in function calls
51
+ "func-call-spacing" : "off" ,
52
+ "@typescript-eslint/func-call-spacing" : [ "error" , "never" ] ,
53
+
54
+ // require double quotes, but avoid escaping
55
+ quotes : "off" ,
56
+ "@typescript-eslint/quotes" : [ "error" , "double" , {
57
+ avoidEscape : true ,
58
+ allowTemplateLiterals : true ,
59
+ } ] ,
60
+
61
+ // IIFE wrap -> (function foo() {})()
62
+ "wrap-iife" : [ "error" , "inside" ] ,
63
+
64
+ // don't allow spaces before commas, require at least one after
65
+ "comma-spacing" : "off" ,
66
+ "@typescript-eslint/comma-spacing" : "error" ,
67
+
68
+ // require at least one space before and after keywords
69
+ "keyword-spacing" : "off" ,
70
+ "@typescript-eslint/keyword-spacing" : "error" ,
23
71
} ,
24
72
ignorePatterns,
25
73
overrides : [ {
26
74
files : [ "test/**/*" ] ,
27
75
rules : {
76
+ // non-null assertions can be useful in tests where we've already asserted something
77
+ // exists before attempting to assert its value
28
78
"@typescript-eslint/no-non-null-assertion" : "off" ,
29
79
} ,
30
80
} ] ,
0 commit comments