-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy patheslint.config.mjs
More file actions
130 lines (122 loc) · 3.75 KB
/
Copy patheslint.config.mjs
File metadata and controls
130 lines (122 loc) · 3.75 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
127
128
129
130
// @ts-check
import pluginJs from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";
import jsxA11y from "eslint-plugin-jsx-a11y";
import prettierRecommended from "eslint-plugin-prettier/recommended";
import reactPlugin from "eslint-plugin-react";
import hooksPlugin from "eslint-plugin-react-hooks";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import globals from "globals";
import tseslint from "typescript-eslint";
const ignores = [
"**/dist",
"**/node_modules",
"**/docs",
"**/examples",
"playwright.config.ts",
"**/coverage/lcov-report",
"eslint.config.mjs",
];
export default [
{ ignores },
{
settings: {
react: {
version: "detect",
},
},
},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
reactPlugin.configs.flat.recommended,
prettierRecommended,
{
files: ["**/*.{jsx,tsx}"],
...jsxA11y.flatConfigs.recommended,
plugins: {
"jsx-a11y": jsxA11y,
"react-hooks": hooksPlugin,
},
languageOptions: {
...jsxA11y.flatConfigs.recommended.languageOptions,
globals: globals.browser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
"jsx-a11y/no-autofocus": "off",
"react/react-in-jsx-scope": "off",
...hooksPlugin.configs.recommended.rules,
},
},
{
plugins: {
"@stylistic": stylistic,
},
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
},
],
"@stylistic/spaced-comment": ["error", "always", { markers: ["/"] }],
},
},
{
plugins: {
"simple-import-sort": simpleImportSort,
},
rules: {
"simple-import-sort/imports": [
"error",
{
groups: [
// Matches any import statement that are 'react'
["^react$"],
// Matches any import statement that starts with '@' followed by any word character
["^@?\\w"],
// Matches any import statement that starts with a dot, but not when it is followed by a forward slash (i.e., not a relative import), and not when it is followed by nothing (i.e., not an absolute import). Also matches import statements that start with two dots, followed by either nothing or a forward slash (i.e., a relative parent import).
["^\\.(?!/?$)", "^\\.\\./?$"],
// Side effect imports.
["^\\u0000"],
],
},
],
},
},
{
rules: {
// Formatting
"prettier/prettier": [
"error",
{
printWidth: 120,
endOfLine: "auto",
overrides: [
{
files: ["*.yml", "*.yaml"],
options: {
tabWidth: 2,
},
},
],
},
],
// React
"react/display-name": "off",
// TypeScript
"@typescript-eslint/no-unused-vars": "error",
},
},
{
files: ["tailwind.config.js"],
rules: {
"@typescript-eslint/no-require-imports": "off",
"no-undef": "off",
},
},
];