-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
eslint.config.mjs
108 lines (106 loc) · 2.58 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
102
103
104
105
106
107
108
import tseslint from "typescript-eslint";
import pluginImport from "eslint-plugin-import";
import pluginReact from "eslint-plugin-react";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginReactCompiler from "eslint-plugin-react-compiler";
import pluginVue from "eslint-plugin-vue";
import solid from "eslint-plugin-solid/configs/typescript";
const languageOptions = {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
};
export default [
{
files: ["src/**/*.{js,jsx,ts,tsx}"],
languageOptions,
settings: {
"import/resolver": {
typescript: true,
},
},
plugins: {
import: pluginImport,
},
rules: {
"import/no-restricted-paths": [
"error",
{
zones: [
{
target: ["./src/core/**/*"],
from: ["./src/!(core)/**/*"],
},
{
target: ["./src/react/**/*"],
from: ["./src/!(core|react)/**/*"],
},
{
target: ["./src/solid/**/*"],
from: ["./src/!(core|solid)/**/*"],
},
{
target: ["./src/svelte/**/*"],
from: ["./src/!(core|svelte)/**/*"],
},
{
target: ["./src/vue/**/*"],
from: ["./src/!(core|vue)/**/*"],
},
],
},
],
},
},
...[
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
{
plugins: {
"react-hooks": pluginReactHooks,
"react-compiler": pluginReactCompiler,
},
rules: {
"react/display-name": "off",
...pluginReactHooks.configs.recommended.rules,
"react-compiler/react-compiler": "warn",
},
},
].map((c) => ({
...c,
files: ["src/react/**/*.{js,jsx,ts,tsx}"],
languageOptions,
settings: {
react: {
version: "detect",
},
},
})),
...[
...pluginVue.configs["flat/recommended"],
{
rules: {
"vue/no-setup-props-reactivity-loss": "warn",
"vue/no-ref-object-reactivity-loss": "error",
"vue/multi-word-component-names": "off",
},
},
].map((c) => ({
// https://github.com/vuejs/vue-eslint-parser/issues/232
...c,
files: ["src/vue/**/*.{js,jsx,ts,tsx}"],
languageOptions,
})),
{
files: ["src/solid/**/*.{js,jsx,ts,tsx}"],
languageOptions,
...solid,
},
];