-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.mjs
120 lines (115 loc) · 2.76 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
import js from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
import importPlugin from "eslint-plugin-import";
import prettier from "eslint-config-prettier";
export default [
// Base JS config
js.configs.recommended,
{
files: ["**/*.{js,jsx,ts,tsx}"],
ignores: ["**/node_modules/*", ".server/*", ".client/*"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
window: true,
document: true,
require: true,
module: true,
__dirname: true,
__filename: true,
process: true,
console: true,
// Add any other globals your application needs
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
"no-async-promise-executor": "warn",
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
},
// React configuration
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
react: reactPlugin,
"jsx-a11y": jsxA11yPlugin,
"react-hooks": reactHooksPlugin,
},
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs["jsx-runtime"].rules,
...reactHooksPlugin.configs.recommended.rules,
...jsxA11yPlugin.configs.recommended.rules,
"no-undef": 0,
},
},
// TypeScript configuration
{
files: ["**/*.{ts,tsx}"],
plugins: {
"@typescript-eslint": tseslint,
import: importPlugin,
},
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
typescript: {
alwaysTryTypes: true,
},
node: {
extensions: [".ts", ".tsx"],
},
},
},
rules: {
...tseslint.configs.recommended.rules,
...importPlugin.configs.recommended.rules,
...importPlugin.configs.typescript.rules,
},
},
// Node configuration for config files
{
files: [".eslintrc.{js,cjs}"],
languageOptions: {
globals: {
process: true,
__dirname: true,
__filename: true,
},
},
},
// Prettier config should be last
prettier,
];