-
Notifications
You must be signed in to change notification settings - Fork 8
/
eslint.config.mjs
152 lines (151 loc) · 5.69 KB
/
eslint.config.mjs
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
152
// @ts-check
import eslint from "@eslint/js";
import eslintPluginAva from "eslint-plugin-ava";
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import globals from "globals";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
files: ["**/*.{ts,tsx,cts,mts,js,cjs,mjs}"],
},
{
ignores: [
"**/dist/**",
"**/node_modules/**",
"bin/**",
"coverage/**",
"Herebyfile.mjs",
],
},
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
eslintPluginUnicorn.configs["flat/recommended"],
eslintPluginAva.configs["flat/recommended"],
{
languageOptions: {
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
ecmaVersion: "latest",
sourceType: "module",
project: true,
},
globals: globals.node,
},
plugins: {
"simple-import-sort": eslintPluginSimpleImportSort,
},
},
{
"rules": {
"eqeqeq": "error",
"no-constant-condition": "off",
"no-inner-declarations": "off",
"no-undef": "off",
"no-unused-vars": "off",
"no-restricted-globals": ["error", "console", "process", "Date"],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
// In theory good, but less good when declaring a new interface and
// stopping to think about its contents.
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-explicit-any": "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/no-unsafe-return": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/naming-convention": [
"error",
{
"selector": [
"classProperty",
"typeProperty",
"parameterProperty",
"classMethod",
"typeMethod",
"accessor",
],
"modifiers": ["private"],
"leadingUnderscore": "require",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
"match": false,
},
},
{
"selector": [
"classProperty",
"typeProperty",
"parameterProperty",
"classMethod",
"typeMethod",
"accessor",
],
"modifiers": ["protected"],
"leadingUnderscore": "allow",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
"match": false,
},
},
{
"selector": [
"classProperty",
"typeProperty",
"parameterProperty",
"classMethod",
"typeMethod",
"accessor",
],
"modifiers": ["public"],
"leadingUnderscore": "forbid",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
"match": false,
},
},
],
"@typescript-eslint/no-unnecessary-condition": ["error", {
"allowConstantLoopConditions": true,
}],
"unicorn/catch-error-name": "off",
"unicorn/filename-case": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/prefer-top-level-await": "off", // Reenable once Node 12 is dropped.
"unicorn/prevent-abbreviations": "off",
"unicorn/switch-case-braces": "off",
"unicorn/prefer-string-replace-all": "off", // Bad suggestion for old targets
},
},
{ "files": ["Herebyfile.*", "**/__fixtures__/**"], "rules": { "no-restricted-globals": "off" } },
{
"files": ["**/__tests__/**"],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"no-restricted-globals": "off",
"ava/no-import-test-files": "off",
},
},
{
files: [
".ncurc.cjs",
"eslint.config.mjs",
],
extends: [tseslint.configs.disableTypeChecked],
},
);