-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
97 lines (90 loc) · 2.57 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
import eslint from "@eslint/js";
import jestPlugin from "eslint-plugin-jest";
import eslingPluginNoRelativeImportPaths from "eslint-plugin-no-relative-import-paths";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import unicornPlugin from "eslint-plugin-unicorn";
import globals from "globals";
import tseslint from "typescript-eslint";
export default tseslint.config(
{
plugins: {
["@typescript-eslint"]: tseslint.plugin,
["no-relative-import-paths"]: eslingPluginNoRelativeImportPaths,
["jest"]: jestPlugin,
["unicorn"]: unicornPlugin,
},
},
{
ignores: [
"**/coverage/",
"**/node_modules/",
"*.js",
".esbuild/",
".pnpm-store/",
"build/",
"dist/",
"eslint.config.mjs",
"gen/",
],
},
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
globals: {
...globals.es2020,
...globals.node,
},
parserOptions: {
allowAutomaticSingleRunInference: true,
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/consistent-indexed-object-style": [
"error",
"index-signature",
],
"@typescript-eslint/dot-notation": "error",
// We'll often do things like `foo.status == NOT_FOUND` and we don't want to
// have to cast `NOT_FOUND` to a number to make this work.
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "all",
argsIgnorePattern: "^_",
caughtErrors: "all",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"@typescript-eslint/restrict-template-expressions": "off",
"dot-notation": "off",
"no-relative-import-paths/no-relative-import-paths": [
"error",
{ allowSameFolder: true },
],
"unicorn/no-typeof-undefined": "error",
},
},
{
files: ["**/*.test.ts"],
...jestPlugin.configs["flat/recommended"],
...jestPlugin.configs["flat/style"],
plugins: {
jest: jestPlugin,
},
rules: {
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
"jest/unbound-method": "error",
},
},
eslintPluginPrettierRecommended,
);