-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy patheslint.config.mjs
More file actions
119 lines (117 loc) · 3.05 KB
/
Copy patheslint.config.mjs
File metadata and controls
119 lines (117 loc) · 3.05 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
import js from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier/flat";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import reactYouMightNotNeedAnEffect from "eslint-plugin-react-you-might-not-need-an-effect";
import globals from "globals";
import tseslint from "typescript-eslint";
import { fileURLToPath } from "node:url";
import path from "node:path";
const rootDir = path.dirname(fileURLToPath(import.meta.url));
const backendFiles = [
"packages/backend/**/*.{js,mjs,cjs,ts}",
"packages/lite-router/**/*.{js,mjs,cjs,ts}",
"packages/sdk/**/*.{js,mjs,cjs,ts}",
];
const frontendFiles = [
"packages/frontend/**/*.{ts,tsx}",
"packages/extension/**/*.{ts,tsx}",
];
const configFiles = ["**/*.config.{js,mjs,cjs,ts}"];
const backendScope = { files: backendFiles, ignores: configFiles };
const frontendScope = { files: frontendFiles, ignores: configFiles };
export default [
{
ignores: [
"**/dist/**",
"**/.output/**",
"**/.wxt/**",
"**/node_modules/**",
"**/coverage/**",
"packages/backend/.wrangler/**",
"packages/backend/drizzle/**",
"packages/backend/worker-configuration.d.ts",
],
},
{
...backendScope,
languageOptions: {
globals: globals.node,
parserOptions: {
tsconfigRootDir: path.join(rootDir, "packages/backend"),
},
},
},
{
...backendScope,
...js.configs.recommended,
},
...tseslint.configs.recommended.map(config => ({
...config,
...backendScope,
})),
{
...backendScope,
rules: {
quotes: ["error", "single"],
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_" },
],
semi: ["error", "always"],
eqeqeq: ["error", "always"],
"object-curly-spacing": ["error", "always"],
"no-trailing-spaces": ["error"],
"no-multi-spaces": ["error"],
"no-multiple-empty-lines": ["error", { max: 1 }],
"space-in-parens": ["error", "never"],
},
},
{
...frontendScope,
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
projectService: true,
tsconfigRootDir: rootDir,
},
},
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
"react-you-might-not-need-an-effect": reactYouMightNotNeedAnEffect,
},
},
{
...frontendScope,
...js.configs.recommended,
},
...tseslint.configs.recommended.map(config => ({
...config,
...frontendScope,
})),
{
...frontendScope,
rules: {
...reactHooks.configs.recommended.rules,
...reactRefresh.configs.vite.rules,
...reactYouMightNotNeedAnEffect.configs.recommended.rules,
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
},
},
{
files: configFiles,
...js.configs.recommended,
languageOptions: {
globals: globals.node,
},
},
eslintConfigPrettier,
];