forked from QuackbackIO/quackback
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
116 lines (114 loc) · 2.88 KB
/
Copy patheslint.config.js
File metadata and controls
116 lines (114 loc) · 2.88 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
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import prettier from "eslint-config-prettier";
// Files that ARE the re-export layer or standalone scripts — they must import @quackback/db directly
const dbReexportFiles = [
"**/src/lib/server/db.ts",
"**/src/lib/shared/db-types.ts",
"**/scripts/**",
];
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
ignores: [
"**/node_modules/**",
"**/.next/**",
"**/.output/**",
"**/dist/**",
"**/build/**",
"**/*.config.js",
"**/*.config.mjs",
"**/next-env.d.ts",
],
},
{
files: ["**/*.{ts,tsx}"],
ignores: dbReexportFiles,
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "warn",
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@quackback/db", "@quackback/db/*"],
message:
"Import from '@/lib/server/db' (server) or '@/lib/shared/db-types' (client) instead.",
},
],
},
],
},
},
// The exempted files still need the base TS rules, just without the import restriction
{
files: dbReexportFiles,
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/no-explicit-any": "warn",
},
},
// lib/ must not import from components/
{
files: ["**/src/lib/**/*.{ts,tsx}"],
ignores: dbReexportFiles,
rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@quackback/db", "@quackback/db/*"],
message:
"Import from '@/lib/server/db' (server) or '@/lib/shared/db-types' (client) instead.",
},
{
group: ["@/components/*", "@/components/**"],
message: "lib/ must not import from components/.",
},
],
},
],
},
},
// Service file size limits
{
files: ["**/server/domains/**/*.{ts,tsx}"],
rules: {
"max-lines": ["warn", { max: 400, skipBlankLines: true, skipComments: true }],
},
},
{
files: ["**/client/hooks/**/*.{ts,tsx}"],
rules: {
"max-lines": ["warn", { max: 300, skipBlankLines: true, skipComments: true }],
},
},
{
files: ["**/*.tsx"],
plugins: {
react,
"react-hooks": reactHooks,
},
settings: {
react: {
version: "detect",
},
},
rules: {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
}
);