-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
135 lines (134 loc) · 4.96 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"jsx": true,
"useJSXTextNode": true,
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"project": "./tsconfig.json",
"tsconfigRootDir": "./"
},
"env": {
"browser": true,
"es6": true,
"node": true
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["@typescript-eslint", "react-hooks", "etc", "react"],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"@typescript-eslint/array-type": [
"error",
{
"default": "array"
}
],
// Enabling the defaults would be nice, but there are approximately 2,000 violations, so probably not worth it for now
"@typescript-eslint/naming-convention": [
"error",
// Enable the equivalent of the TSLint class-name rule.
{
"selector": ["class", "interface"],
"format": ["PascalCase"]
}
],
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowShortCircuit": true,
"allowTernary": true
}
],
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"curly": "error",
"eqeqeq": ["error", "smart"],
"id-match": "error",
"new-parens": "error",
"no-eval": "error",
"@typescript-eslint/no-invalid-this": "error",
"no-new-wrappers": "error",
"@typescript-eslint/no-redeclare": ["error", { "ignoreDeclarationMerge": true }],
"no-var": "error",
"prefer-const": ["error", {"destructuring": "all"} ],
"spaced-comment": [
"error",
"always",
{
"markers": ["/"]
}
],
"etc/no-const-enum": "error",
"no-restricted-imports": ["error", {
"paths": [{
"name": "@fluentui/react",
"importNames": ["Dropdown"],
"message": "Please use Dropdown from src/controls/Dropdown instead."
}]
}],
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/quotes": ["error", "single", {
"allowTemplateLiterals": true
}],
"@typescript-eslint/type-annotation-spacing": ["error"],
"@typescript-eslint/space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"react/display-name": ["error"],
// Using angle bracket syntax for type assertions can confuse Next's SWC TypeScript compiler
// because it doesn't distinguish between .ts and .tsx files.
"@typescript-eslint/consistent-type-assertions": ["error"],
// The following rules come from our common config, but are disabled because of the massive
// codebase churn they would cause.
"prefer-arrow/prefer-arrow-functions": "off",
"comma-dangle": "off",
"@typescript-eslint/promise-function-async": "off",
"import/order": "off",
"unicorn/filename-case": "off",
"import/no-unassigned-import": "off",
"dot-notation": "off",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/tslint/config": "off",
"object-shorthand": "off",
"arrow-body-style": "off",
"no-invalid-this": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/no-parameter-properties": "off",
"no-useless-constructor": "off",
"one-var": "off",
"no-undef-init": "off",
"no-duplicate-imports": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off", // This rule's auto-fixer doesn't work well, and can potentially break things.
// The following rules from the common config are potentially useful, but require a team discussion before adoption.
"no-restricted-syntax": "off", // forbids for .. in loops
"@typescript-eslint/no-for-in-array": "off",
"prefer-template": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"no-param-reassign": "off",
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off", // May not be safe without strict null checks
"no-fallthrough": "off", // forbids fallthroughs in switch statements
"no-unused-expressions": [2, {
"allowShortCircuit": true,
"allowTernary": true
}],
"@typescript-eslint/ban-types": "off", // Bans some of TS's more confusing types. We should strongly consider implementing this one.
"@typescript-eslint/no-floating-promises": "off",
"radix": "off", // Requires the radix argument for parseInt(), like parseInt(someString, 10) to avoid problems with octal numbers.
"no-throw-literal": "off" // Only one violation, but it requires discussion
}
}