-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.js
75 lines (73 loc) · 1.93 KB
/
eslint.config.js
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
import globals from "globals";
import jsPlugin from "@eslint/js";
import tsPlugin from "typescript-eslint";
import prettierOverrides from "eslint-config-prettier";
import prettierRules from "eslint-plugin-prettier/recommended";
import unicornPlugin from "eslint-plugin-unicorn";
import hooksPlugin from "eslint-plugin-react-hooks";
import allowedDepsPlugin from "eslint-plugin-allowed-dependencies";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const dirName = dirname(fileURLToPath(import.meta.url));
export default tsPlugin.config(
{
languageOptions: { globals: { ...globals.node, ...globals.browser } },
plugins: {
unicorn: unicornPlugin,
allowed: allowedDepsPlugin,
"react-hooks": hooksPlugin,
},
},
jsPlugin.configs.recommended,
tsPlugin.configs.recommended,
prettierOverrides,
prettierRules,
// Things to turn off globally
{ ignores: ["*/dist/"] },
// Things to turn on globally
{
rules: {
"unicorn/prefer-node-protocol": "error",
},
},
// For the sources
{
files: ["backend/src/*.ts"],
rules: {
"allowed/dependencies": [
"error",
{ packageDir: join(dirName, "backend") },
],
},
},
{
files: ["frontend/src/*.+(ts|tsx)"],
rules: {
"allowed/dependencies": [
"error",
{ packageDir: join(dirName, "frontend") },
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
// For tests
{
files: ["backend/src/*.spec.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"allowed/dependencies": "off",
},
},
// Special needs of the generated code
{
files: ["frontend/src/generated/*.+(ts|tsx)"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-object-type": [
"error",
{ allowObjectTypes: "always" },
],
},
},
);