-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
106 lines (100 loc) · 3.19 KB
/
eslint.config.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
import { fixupPluginRules } from "@eslint/compat";
import eslint from "@eslint/js";
import legacyNextPlugin from "@next/eslint-plugin-next";
import eslintConfigPrettier from "eslint-config-prettier";
import compat from "eslint-plugin-compat";
import legacyImportPlugin from "eslint-plugin-import";
import reactPluginJsxRuntime from "eslint-plugin-react/configs/jsx-runtime.js";
import reactPluginRecommended from "eslint-plugin-react/configs/recommended.js";
import legacyHooksPlugin from "eslint-plugin-react-hooks";
import globals from "globals";
import tseslint from "typescript-eslint";
const nextPlugin = fixupPluginRules(legacyNextPlugin);
const hooksPlugin = fixupPluginRules(legacyHooksPlugin);
const importPlugin = fixupPluginRules(legacyImportPlugin);
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
compat.configs["flat/recommended"],
reactPluginRecommended,
reactPluginJsxRuntime,
eslintConfigPrettier,
{
plugins: {
"react-hooks": hooksPlugin,
"@next/next": nextPlugin,
import: importPlugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: "./tsconfig.json",
},
globals: {
...globals.browser,
...globals.serviceworker,
},
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
node: true,
},
"import/core-modules": [
"bun",
"bun:ffi",
"bun:jsc",
"bun:sqlite",
"bun:test",
],
},
rules: {
// Legacy shared config rules
...hooksPlugin.configs.recommended.rules,
...nextPlugin.configs["core-web-vitals"].rules,
...importPlugin.configs["recommended"].rules,
...importPlugin.configs["typescript"].rules,
// DI-specific rules
"object-shorthand": "error",
"no-alert": "error",
"no-debugger": "error",
"no-else-return": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: {
attributes: false,
},
},
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-unnecessary-type-parameters": "error",
"@typescript-eslint/no-unsafe-unary-minus": "error",
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-unnecessary-template-expression": "error",
"import/default": "off",
"import/named": "off",
"import/namespace": "off",
"import/no-amd": "error",
"import/no-commonjs": "error",
"import/no-absolute-path": "error",
"import/no-dynamic-require": "error",
"import/no-named-as-default-member": "off",
"import/no-self-import": "error",
"import/no-useless-path-segments": "error",
"import/order": [
"error",
{ "newlines-between": "always", alphabetize: { order: "asc" } },
],
"import/no-unresolved": "off",
},
},
);