-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy patheslint.config.mjs
More file actions
90 lines (78 loc) · 2.4 KB
/
Copy patheslint.config.mjs
File metadata and controls
90 lines (78 loc) · 2.4 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
// @ts-check
import globals from "globals";
import { defineConfig } from "eslint/config";
import eslint from "@eslint/js";
import { configs as tseslint } from "typescript-eslint";
import { flatConfigs as importPlugin } from "eslint-plugin-import-x";
import reactPlugin from "eslint-plugin-react";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import jsxA11yPugin from "eslint-plugin-jsx-a11y";
import prettierPlugin from "eslint-plugin-prettier/recommended";
import { createTypeScriptImportResolver } from "eslint-import-resolver-typescript";
export default defineConfig(
{
ignores: [
"**/.idea/",
"**/.vscode/",
"**/.docusaurus/",
"**/node_modules/",
"build/",
".netlify/",
],
},
eslint.configs.recommended,
tseslint.recommendedTypeChecked,
importPlugin.recommended,
importPlugin.typescript,
reactPlugin.configs.flat?.recommended,
reactPlugin.configs.flat?.["jsx-runtime"],
reactHooksPlugin.configs.flat.recommended,
jsxA11yPugin.flatConfigs.recommended,
prettierPlugin,
{
files: ["**/*.{js,jsx,ts,tsx,mjs}"],
languageOptions: {
...reactPlugin.configs.flat?.recommended.languageOptions,
globals: {
...globals.browser,
...globals.node,
...globals.commonjs,
...globals.es2024,
window: true,
},
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
projectService: true,
},
},
settings: {
react: {
version: "detect",
},
"import-x/resolver-next": [
createTypeScriptImportResolver({
alwaysTryTypes: true,
project: "./tsconfig.json",
// `@docusaurus/tsconfig` sets `baseUrl` to its own package dir under
// `node_modules/`, which mis-anchors the `@site/*` -> `./*` mapping
// there. Re-anchor at the project root.
alias: {
"@site": [import.meta.dirname],
},
}),
],
},
rules: {
"react/jsx-uses-react": "error",
"@typescript-eslint/no-unused-vars": "error",
// Docusaurus virtual modules — declared as ambient types in
// `@docusaurus/module-type-aliases` and resolved by webpack at build
// time. They have no on-disk path for the resolver to find.
"import-x/no-unresolved": [
"error",
{ ignore: ["^@theme-(original|init)/", "^@generated/"] },
],
},
},
);