-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.json
151 lines (148 loc) · 5.46 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
"$schema": "https://json.schemastore.org/eslintrc",
"ignorePatterns": ["node_modules", "dist", "tmp", "__fixtures__", "__generated__", ".direnv", "bin/run.js"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true
},
"plugins": ["@typescript-eslint", "import", "unicorn", "only-warn"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:jsdoc/recommended-typescript",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
],
"env": {
"node": true
},
"settings": {
"import/extensions": [".js", ".jsx", ".ts", ".tsx"],
"import/resolver": {
"node": true,
"typescript": true
}
},
"rules": {
"curly": ["warn", "all"],
"eqeqeq": ["warn", "smart"],
"func-style": ["warn", "expression"],
"max-depth": ["warn", 3],
"no-unneeded-ternary": ["warn"],
"object-shorthand": ["warn", "always"],
"prefer-const": ["warn", { "destructuring": "all" }],
"quotes": ["warn", "double", { "avoidEscape": true }],
"spaced-comment": ["warn", "always"],
"jsdoc/require-hyphen-before-param-description": ["warn"],
"jsdoc/require-jsdoc": ["warn", { "publicOnly": true }],
"jsdoc/require-param": ["off"],
"jsdoc/require-returns": ["off"],
"jsdoc/tag-lines": ["warn", "never", { "startLines": 1 }],
"unicorn/consistent-destructuring": ["warn"],
"unicorn/explicit-length-check": ["warn"],
"unicorn/filename-case": ["warn", { "case": "kebabCase" }],
"unicorn/no-null": ["warn"],
"unicorn/no-object-as-default-parameter": ["warn"],
"unicorn/prefer-node-protocol": ["warn"],
"unicorn/template-indent": ["warn"],
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
"@typescript-eslint/consistent-type-imports": ["warn", { "prefer": "type-imports", "fixStyle": "inline-type-imports" }],
// prettier-ignore
"@typescript-eslint/explicit-function-return-type": ["warn", { "allowExpressions": true, "allowTypedFunctionExpressions": true, "allowHigherOrderFunctions": true, "allowDirectConstAssertionInArrowFunctions": true, "allowConciseArrowFunctionExpressionsStartingWithVoid": true, "allowFunctionsWithoutTypeParameters": false, "allowedNames": [], "allowIIFEs": false }],
"@typescript-eslint/member-ordering": ["warn"],
// prettier-ignore
"@typescript-eslint/naming-convention": ["warn", { "selector": "memberLike", "modifiers": ["private"], "format": ["camelCase"], "leadingUnderscore": "require" }],
"@typescript-eslint/no-confusing-void-expression": ["warn", { "ignoreArrowShorthand": true }],
"@typescript-eslint/no-unused-expressions": ["warn", { "allowTaggedTemplates": true }],
"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
"@typescript-eslint/prefer-nullish-coalescing": ["warn", { "ignorePrimitives": { "string": true } }],
"@typescript-eslint/restrict-template-expressions": ["warn", { "allowNumber": true }]
},
"overrides": [
{
"files": "src/**",
"rules": {
"no-restricted-imports": [
"warn",
{
"paths": [
{
"name": "figures",
"message": "use src/services/output/symbols.ts instead"
}
],
"patterns": [
{
"group": ["/src"],
"message": "src files must be imported relatively (e.g. ../../src)"
},
{
"group": ["spec/"],
"message": "src files cannot import spec files"
}
]
}
]
}
},
{
"files": "src/services/util/**",
"rules": {
"no-restricted-imports": [
"warn",
{
"paths": [
{
"name": "figures",
"message": "use src/services/output/symbols.ts instead"
}
],
"patterns": [
{
"group": ["/src"],
"message": "src files must be imported relatively (e.g. ../../src)"
},
{
"group": ["../"],
"message": "utilities can only import other utilities"
}
]
}
]
}
},
{
"files": "spec/**",
"rules": {
"no-restricted-imports": [
"warn",
{
"paths": [{ "name": "node:test", "message": "Use 'vitest' instead" }],
"patterns": [
{
"group": ["/src"],
"message": "src files must be imported relatively (e.g. ../../src)"
},
{
"group": ["/spec"],
"message": "spec files must be imported relatively (e.g. ../../spec)"
}
]
}
],
"@typescript-eslint/no-dynamic-delete": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unnecessary-condition": ["off"],
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": ["off"],
"@typescript-eslint/no-unsafe-member-access": ["off"],
"@typescript-eslint/unbound-method": "off",
"unicorn/template-indent": ["off"]
}
}
]
}