-
-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy patheslint.config.js
More file actions
119 lines (111 loc) · 2.57 KB
/
eslint.config.js
File metadata and controls
119 lines (111 loc) · 2.57 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import globals from 'globals'
import js from '@eslint/js'
import astro from 'eslint-plugin-astro'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import astroParser from 'astro-eslint-parser'
export default [
// Ignore patterns
{
ignores: [
'dist/**',
'node_modules/**',
'.astro/**',
'**/*.d.ts', // Ignore generated TypeScript declaration files
],
},
// Base configuration for all files
{
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
},
// ESLint recommended rules
js.configs.recommended,
// JavaScript files
{
files: ['**/*.js'],
rules: {
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
},
},
// Astro files
{
files: ['**/*.astro'],
plugins: {
astro,
},
languageOptions: {
parser: astroParser,
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
},
rules: {
...astro.configs.recommended.rules,
...astro.configs['jsx-a11y-strict'].rules,
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
},
},
// TypeScript files
{
files: ['**/*.ts'],
plugins: {
'@typescript-eslint': tseslint,
},
languageOptions: {
parser: tsParser,
},
rules: {
...tseslint.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' }],
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
// JSX files (React components)
{
files: ['**/*.jsx'],
plugins: {
'jsx-a11y': jsxA11y,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
...jsxA11y.configs.strict.rules,
},
},
// TypeScript JSX files (React components)
{
files: ['**/*.tsx'],
plugins: {
'@typescript-eslint': tseslint,
'jsx-a11y': jsxA11y,
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
...tseslint.configs.recommended.rules,
...jsxA11y.configs.strict.rules,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' }],
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
]