-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
113 lines (98 loc) · 2.74 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
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
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:import/errors",
],
plugins: ["import"],
overrides: [
{
files: ["src/**"],
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
},
// all Typescript files, including config files
{
files: ["**/*.ts", "**/*.tsx"],
plugins: ["@typescript-eslint"],
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:import/typescript",
],
rules: {
// we prefer the inferred return value of the function
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
// we override and allow some unused vars if they start with _
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
// these import rules are handled by typescript natively
"import/default": "off",
"import/named": "off",
"import/namespace": "off",
"import/no-named-as-default-member": "off",
"import/no-unresolved": "off",
},
},
],
env: {
node: true,
},
// global rules
rules: {
// prevent mistaken access of properties on default export
"import/no-named-as-default-member": "error",
// consistent typescript type imports
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
// avoid using deprecated exports
"import/no-deprecated": "warn",
// enforce import ordering for cleaner diffs
"import/order": [
"warn",
{
alphabetize: {
order: "asc",
},
warnOnUnassignedImports: false,
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
"newlines-between": "always",
},
],
// to keep imports easy to read
"import/no-useless-path-segments": "error",
"no-console": "error",
"no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
},
env: {
es6: true,
},
settings: {
"import/resolver": {
typescript: { alwaysTryTypes: false },
},
},
};