-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.js
112 lines (111 loc) · 2.69 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
107
108
109
110
111
112
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
import { fixupPluginRules } from "@eslint/compat";
import js from "@eslint/js";
import prettierConfig from "eslint-config-prettier";
import importX from "eslint-plugin-import-x";
import perfectionist from "eslint-plugin-perfectionist";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import globals from "globals";
import ts from "typescript-eslint";
/* eslint-disable perfectionist/sort-objects */
/** @type {import("eslint").Linter.Config[]} */
export default ts.config(
prettierConfig,
perfectionist.configs["recommended-natural"],
comments.recommended,
js.configs.recommended,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
importX.flatConfigs.react,
{
linterOptions: {
reportUnusedDisableDirectives: "error",
},
},
{
files: ["**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs}"],
languageOptions: {
parser: ts.parser,
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.serviceworker,
...globals.browser,
...globals.node,
...globals.builtin,
...globals.es2021,
},
},
settings: {
react: {
version: "detect",
},
},
plugins: {
"react-hooks": fixupPluginRules(reactHooks),
},
rules: {
...reactHooks.configs.recommended.rules,
"import-x/no-cycle": "error",
"import-x/no-extraneous-dependencies": "error",
"perfectionist/sort-module": "off",
"perfectionist/sort-modules": "off",
"react/function-component-definition": [
"error",
{ namedComponents: "function-declaration" },
],
},
},
{
files: ["**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs}"],
...react.configs.flat.recommended,
...react.configs.flat["jsx-runtime"],
},
{
files: ["**/*.{ts,tsx,cts,mts}"],
languageOptions: {
parserOptions: {
project: ["./tsconfig.json"],
},
},
extends: [
...ts.configs.strictTypeChecked,
...ts.configs.stylisticTypeChecked,
],
rules: {
"@typescript-eslint/array-type": ["error", { default: "generic" }],
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/prefer-nullish-coalescing": [
"error",
{
ignorePrimitives: {
bigint: false,
boolean: false,
number: false,
string: true,
},
},
],
"@typescript-eslint/switch-exhaustiveness-check": "error",
},
},
{
ignores: [
".idea",
".output",
".vinxi",
"node_modules",
"app/routeTree.gen.ts",
],
},
);
/* eslint-enable perfectionist/sort-objects */