-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
96 lines (93 loc) · 2.97 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
import js from "@eslint/js";
import ts from "typescript-eslint";
import globals from "globals";
import importPlugin from "eslint-plugin-import";
import jsxA11y from "eslint-plugin-jsx-a11y";
import prettierRecommended from "eslint-plugin-prettier/recommended";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
// https://typescript-eslint.io/packages/typescript-eslint#config
export default ts.config(
// Base
{
ignores: ["!**/.server", "!**/.client"],
languageOptions: {
globals: { ...globals.browser, ...globals.commonjs, ...globals.es2015 },
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: { jsx: true },
project: ["./tsconfig.json"],
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
extends: [js.configs.recommended],
},
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
"react": react,
"react-hooks": reactHooks,
"jsx-a11y": jsxA11y,
},
rules: {
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,
...reactHooks.configs.recommended.rules,
...jsxA11y.flatConfigs.recommended.rules,
"react-hooks/exhaustive-deps": ["warn", { additionalHooks: "useEnhancedEffect" }],
},
settings: {
"react": { version: "detect" },
"formComponents": ["Form"],
"linkComponents": [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": { typescript: {} },
},
},
// Typescript
{
files: ["**/*.{ts,tsx}"],
extends: [
...ts.configs.strictTypeChecked,
...ts.configs.stylisticTypeChecked,
importPlugin.flatConfigs.recommended,
],
rules: {
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
},
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
typescript: {
alwaysTryTypes: true,
},
},
},
},
// Node
{
files: ["*.config.mjs", "*.config.ts"],
languageOptions: {
globals: globals.node,
},
},
// Prettier
{ ...prettierRecommended },
);