-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy patheslint.config.mjs
More file actions
105 lines (96 loc) · 2.63 KB
/
eslint.config.mjs
File metadata and controls
105 lines (96 loc) · 2.63 KB
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
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import reactPlugin from "eslint-plugin-react";
import importPlugin from "eslint-plugin-import";
import tseslint from "typescript-eslint";
export default [
// Global ignores
{
ignores: ["build/**", "example/**", "node_modules/**", "*.config.*.js"]
},
// Base recommended rules
js.configs.recommended,
// TypeScript recommended rules
...tseslint.configs.recommended,
// Main source files
{
files: ["src/**/*.ts", "src/**/*.tsx"],
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
globals: {
// Browser globals
window: "readonly",
document: "readonly",
navigator: "readonly",
fetch: "readonly",
localStorage: "readonly",
sessionStorage: "readonly",
setTimeout: "readonly",
clearTimeout: "readonly",
setInterval: "readonly",
clearInterval: "readonly",
console: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
FormData: "readonly",
HTMLElement: "readonly",
HTMLIFrameElement: "readonly",
Element: "readonly",
Event: "readonly",
CustomEvent: "readonly"
}
},
plugins: {
react: reactPlugin,
import: importPlugin
},
settings: {
react: {
pragma: "h",
version: "16.0"
},
"import/ignore": [
// Vite query suffixes like ?inline, ?raw, ?url, etc.
"\\?inline$",
"\\?raw$",
"\\?url$"
]
},
rules: {
// React/Preact rules
...reactPlugin.configs.recommended.rules,
"react/prop-types": "off",
"react/no-unknown-property": "off",
"react/no-unescaped-entities": "off",
// Import rules - TypeScript handles module resolution
"import/no-unresolved": "off",
"import/named": "off",
// TypeScript rules
"@typescript-eslint/no-unused-vars": [
"error",
{ vars: "all", args: "none", ignoreRestSiblings: true }
],
"@typescript-eslint/no-explicit-any": "off",
// General rules
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-unused-vars": "off" // Use TypeScript version instead
}
},
// Test files (Vitest)
{
files: ["**/*.test.ts", "**/*.spec.ts"],
rules: {
// Tests use dynamic imports and mocks
"@typescript-eslint/no-unused-expressions": "off"
}
},
// Prettier must be last to override other formatting rules
prettier
];