-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
127 lines (125 loc) · 3.13 KB
/
eslint.config.js
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
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import globals from "globals";
import importPlugin from "eslint-plugin-import";
import reactPlugin from "eslint-plugin-react";
import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import stylistic from "@stylistic/eslint-plugin";
const __dirname = new URL(".", import.meta.url).pathname;
export default [
js.configs.recommended,
importPlugin.flatConfigs.recommended,
{
ignores: [
"build/*",
"build/**/*",
"**/build/**/*",
"eslint.config.mjs",
"coverage/*",
"coverage/**/*",
"node_modules/*",
"node_modules/**/*",
"global.d.ts",
"**/*.test.ts",
"**/*.test.js",
"**/*.test.tsx",
"**/*.test.jsx",
"**/*.spec.ts",
"**/*.spec.js",
"**/*.spec.tsx",
"**/*.spec.jsx",
],
},
{
files: ["**/*.{js,jsx,ts,tsx}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.browser,
...globals.commonjs,
...globals.es6,
...globals.jest,
process: "readonly",
},
},
plugins: {
"react": reactPlugin,
"jsx-a11y": jsxA11yPlugin,
"react-hooks": reactHooksPlugin,
},
rules: {
...reactHooksPlugin.configs.recommended.rules,
...reactPlugin.configs.recommended.rules,
...jsxA11yPlugin.configs.recommended.rules,
"react/no-unescaped-entities": "off",
"react/display-name": "off",
"react/prop-types": "off",
"no-prototype-builtins": "off",
},
settings: {
"react": {
version: "detect",
},
"jest": {
version: 27,
},
"formComponents": ["Form"],
"linkComponents": [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./tsconfig.json",
},
},
"import/ignore": [".(css)$"],
},
},
// TypeScript configuration
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
globals: {
...globals.node,
React: "readonly",
NodeJS: "readonly",
},
},
plugins: {
"@typescript-eslint": tseslint.plugin,
},
rules: {
...tseslint.configs.recommended.rules,
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/ban-ts-comment": "off",
},
},
// Node environment for eslint.config.mjs
{
files: ["eslint.config.mjs"],
env: {
node: true,
},
},
stylistic.configs["disable-legacy"],
stylistic.configs.customize({
flat: true,
indent: 2,
quotes: "double",
semi: true,
commaDangle: "always-multiline",
jsx: true,
}),
];