-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy patheslint.config.js
More file actions
126 lines (124 loc) · 3.13 KB
/
eslint.config.js
File metadata and controls
126 lines (124 loc) · 3.13 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
120
121
122
123
124
125
126
import { defineConfig } from 'eslint/config';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import tseslint from 'typescript-eslint';
import checkFile from 'eslint-plugin-check-file';
import eslintPluginTanstackQuery from '@tanstack/eslint-plugin-query';
import pluginRouter from '@tanstack/eslint-plugin-router';
export default defineConfig([
{
ignores: [
'node_modules',
'build',
'dist',
'coverage',
'playwright-report',
'test-results',
],
},
{
files: ['**/*.ts', '**/*.tsx'],
extends: [...tseslint.configs.recommended, eslintPluginPrettier],
settings: {
'import/resolver': {
'eslint-import-resolver-typescript': true,
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json',
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
},
{
...react.configs.flat.recommended,
plugins: {
...react.configs.flat.recommended?.plugins,
'jsx-a11y': jsxA11y,
import: importPlugin,
},
rules: {
...react.configs.flat.recommended?.rules,
'import/no-anonymous-default-export': 'warn',
'react/no-unknown-property': 'off',
'react/react-in-jsx-scope': 'off',
'jsx-a11y/alt-text': [
'warn',
{
elements: ['img'],
img: ['Image'],
},
],
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'react/jsx-no-target-blank': 'off',
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'ignore' },
],
},
settings: {
react: {
version: 'detect',
},
},
},
{
...react.configs.flat['jsx-runtime'],
},
{
...reactHooks.configs.flat['recommended-latest'],
},
...eslintPluginTanstackQuery.configs['flat/recommended'],
...pluginRouter.configs['flat/recommended'],
{
linterOptions: {
reportUnusedDisableDirectives: true,
},
languageOptions: {
parserOptions: {
projectService: true,
},
},
},
{
files: ['**/*.ts', '**/*.tsx'],
plugins: { 'check-file': checkFile },
rules: {
'check-file/filename-naming-convention': [
'error',
{
'**/*.{js,jsx,ts,tsx}': 'KEBAB_CASE',
},
],
'check-file/folder-naming-convention': [
'error',
{
'src/**/!(__tests__|__test__|__mocks__|__snapshots__|__fixtures__)/':
'KEBAB_CASE',
},
],
},
},
{
files: [
'**/*.spec.{js,jsx,ts,tsx}',
'**/*.test.{js,jsx,ts,tsx}',
'**/*.d.ts',
'src/vite-env.d.ts',
'vite.config.ts',
'vitest.config.ts',
],
rules: {
'check-file/filename-naming-convention': 'off',
},
}
]);