-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
46 lines (41 loc) · 1.71 KB
/
Copy patheslint.config.mjs
File metadata and controls
46 lines (41 loc) · 1.71 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
import { defineConfig, globalIgnores } from "eslint/config";
import nextVitals from "eslint-config-next/core-web-vitals";
import nextTs from "eslint-config-next/typescript";
// Single flat config for the whole npm-workspaces monorepo (run via `npm run lint`).
// - Next.js + React rules apply only to the controller (the only web/JSX package).
// - TypeScript rules apply to every package.
export default defineConfig([
globalIgnores([
"**/node_modules/**",
"**/dist/**",
"**/.next/**",
"**/out/**",
"**/build/**",
"**/next-env.d.ts",
// Prisma's generated client is not ours to lint.
"packages/controller/src/generated/**",
]),
// Next.js / React rules — controller only.
...nextVitals.map((c) => ({ ...c, files: ["packages/controller/**/*.{ts,tsx}"] })),
// TypeScript rules — all packages.
...nextTs.map((c) => ({ ...c, files: ["**/*.{ts,tsx}"] })),
// The Next.js plugin lives under packages/controller in this monorepo.
{ settings: { next: { rootDir: "packages/controller" } } },
// Project rule tweaks.
{
files: ["**/*.{ts,tsx}"],
rules: {
// Allow intentionally-unused bindings prefixed with `_`
// (e.g. `const { db: _omitDb, ...rest } = resource`).
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
],
// React Compiler rules (new in react-hooks v6, pulled in by core-web-vitals):
// they misfire on server components (`Date.now()` during render) and on the
// idiomatic "mounted" effect pattern. Off until we adopt the compiler.
"react-hooks/purity": "off",
"react-hooks/set-state-in-effect": "off",
},
},
]);