-
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy patheslint.config.mjs
More file actions
99 lines (90 loc) · 2 KB
/
eslint.config.mjs
File metadata and controls
99 lines (90 loc) · 2 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
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
import vitestPlugin from "@vitest/eslint-plugin";
import testingLibraryPlugin from "eslint-plugin-testing-library";
import globals from "globals";
export default [
// Ignore patterns
{
ignores: ["dist/**", "storybook-static/**", "*.config.js"],
},
// ESLint recommended rules
js.configs.recommended,
// TypeScript ESLint recommended rules
...tseslint.configs.recommended,
// React plugin flat config
{
files: ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"],
...reactPlugin.configs.flat.recommended,
languageOptions: {
...reactPlugin.configs.flat.recommended.languageOptions,
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
},
},
settings: {
react: {
version: "detect",
},
},
},
// React hooks recommended
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
"react-hooks": reactHooksPlugin,
},
rules: {
...reactHooksPlugin.configs.recommended.rules,
},
},
// JSX A11y recommended
{
files: ["**/*.{jsx,tsx}"],
plugins: {
"jsx-a11y": jsxA11yPlugin,
},
rules: {
...jsxA11yPlugin.configs.recommended.rules,
},
},
// Testing Library React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: {
"testing-library": testingLibraryPlugin,
},
rules: {
...testingLibraryPlugin.configs.react.rules,
},
},
// Test files configuration
{
files: ["**/*.test.{js,ts,jsx,tsx}", "**/*.spec.{js,ts,jsx,tsx}"],
plugins: {
vitest: vitestPlugin,
},
languageOptions: {
globals: {
...vitestPlugin.environments.env.globals,
},
},
rules: {
...vitestPlugin.configs.recommended.rules,
},
},
// Custom rules overrides
{
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
rules: {
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
},
},
];