-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.ts
More file actions
77 lines (69 loc) · 1.91 KB
/
eslint.config.ts
File metadata and controls
77 lines (69 loc) · 1.91 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
// eslint.config.ts
import eslintConfigPrettier from 'eslint-config-prettier'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig } from 'eslint/config'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import js from '@eslint/js'
export default defineConfig([
// Ignore build and generated folders
{
ignores: [
'dist',
'build',
'coverage',
'.papi',
'.vite',
'.vscode',
'.wrangler',
'node_modules',
'*.config.{js,mjs,cjs}',
'.prettierrc.*',
'src/__tests__',
],
},
// Base JS preset
js.configs.recommended,
// Type-checked TS presets (require parserOptions.project)
...tseslint.configs.recommendedTypeChecked,
// Optionally add stricter stylistic, non-formatting rules:
// ...tseslint.configs.stylisticTypeChecked,
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parser: tseslint.parser,
parserOptions: {
// Point to all tsconfigs that represent code you lint
project: ['tsconfig.json'],
tsconfigRootDir: process.cwd(),
},
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
// React Compiler guidance: Hooks flat preset
...reactHooks.configs.recommended.rules,
// Vite React Fast Refresh rule (adjust as you like)
'react-refresh/only-export-components': [
'off',
{ allowConstantExport: true },
],
// Useful TS ergonomics
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
// Keep last to disable stylistic rules that conflict with Prettier
eslintConfigPrettier,
])