-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheslint.config.js
More file actions
83 lines (75 loc) · 2.16 KB
/
Copy patheslint.config.js
File metadata and controls
83 lines (75 loc) · 2.16 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
import { fixupPluginRules } from '@eslint/compat';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import astro from 'eslint-plugin-astro';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import globals from 'globals';
const reactPlugin = fixupPluginRules(react);
export default [
{
ignores: [
'dist/**',
'node_modules/**',
'.astro/**',
'public/**',
'tmp/**',
'coverage/**',
'playwright-report/**',
'test-results/**',
'.netlify/**',
],
},
// Base JS rules everywhere
js.configs.recommended,
// TypeScript (.ts, .tsx)
...tseslint.configs.recommended,
// React (.tsx) — React 19 with jsx-runtime, no React-in-scope needed
{
files: ['**/*.tsx'],
...react.configs.flat.recommended,
...react.configs.flat['jsx-runtime'],
languageOptions: {
...react.configs.flat.recommended.languageOptions,
globals: { ...globals.browser },
},
settings: { react: { version: 'detect' } },
plugins: {
react: reactPlugin,
'react-hooks': reactHooks,
'jsx-a11y': jsxA11y,
},
rules: {
...react.configs.flat.recommended.rules,
...react.configs.flat['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
...jsxA11y.flatConfigs.recommended.rules,
'react/prop-types': 'off',
},
},
// Astro (.astro) — requires the plugin's own flat presets
...astro.configs.recommended,
...astro.configs['jsx-a11y-recommended'],
// Node scripts (plain JS)
{
files: ['scripts/**/*.js', '*.config.js', '*.config.ts', '*.config.mjs'],
languageOptions: {
globals: { ...globals.node },
ecmaVersion: 'latest',
sourceType: 'module',
},
},
// Vitest test files — relax a few rules that are noisy in tests
{
files: ['scripts/__tests__/**/*.test.js', 'tests/**/*.{js,ts}'],
languageOptions: {
globals: { ...globals.node },
},
rules: {
'no-empty': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
];