-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.mjs
101 lines (91 loc) · 1.97 KB
/
eslint.config.mjs
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
import eslint from '@eslint/js'
import react from '@eslint-react/eslint-plugin'
import stylistic from '@stylistic/eslint-plugin'
import eslintPluginAstro from 'eslint-plugin-astro'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import tailwindcss from 'eslint-plugin-tailwindcss'
const GLOB_TS = '**/*.?([cm])ts'
const GLOB_TSX = '**/*.tsx'
const GLOB_JS = '**/*.?([cm])js'
const GLOB_JSX = '**/*.jsx'
const GLOB_MDX = '**/*.mdx'
const GLOB_ASTRO = '**/*.astro'
/** @type {import('eslint').Linter.Config[]} */
export default [
// Envs
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
},
},
// Syntax rules
eslint.configs.recommended,
...tseslint.configs.recommended,
...eslintPluginAstro.configs['flat/all'],
...tailwindcss.configs['flat/recommended'],
{
settings: {
tailwindcss: {
config: './configs/tailwind-config/src/index.ts',
},
},
},
// Code style rules
stylistic.configs['disable-legacy'],
stylistic.configs.customize({
flat: true,
indent: 2,
jsx: true,
quotes: 'single',
semi: false,
}),
{
files: [
GLOB_TS,
GLOB_TSX,
GLOB_JS,
GLOB_JSX,
GLOB_ASTRO,
GLOB_MDX,
],
...jsxA11y.flatConfigs.strict,
languageOptions: {
...jsxA11y.flatConfigs.strict.languageOptions,
},
plugins: {
'jsx-a11y': jsxA11y,
},
rules: {
'@typescript-eslint/no-empty-object-type': ['error', { allowInterfaces: 'always' }],
'astro/semi': ['error', 'never'],
},
},
// React
{
files: [
GLOB_TS,
GLOB_TSX,
GLOB_JS,
GLOB_JSX,
GLOB_MDX,
],
...react.configs.recommended,
languageOptions: {
parser: tseslint.parser,
},
},
{
ignores: [
'**/node_modules',
'**/dist',
'**/coverage',
'**/storybook-static',
],
},
]