-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
110 lines (109 loc) · 3.81 KB
/
.eslintrc.cjs
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
const { include: nodeFiles } = require("./tsconfig.node.json");
/** @type {import('eslint').Linter.Config} */
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: { project: ["tsconfig.json", "tsconfig.node.json", "server/tsconfig.json"] },
settings: { react: { version: "detect" }, "import/resolver": "typescript" },
extends: [
"universe",
"eslint:recommended",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:@eslint-community/eslint-plugin-eslint-comments/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"plugin:regexp/recommended",
"plugin:unicorn/recommended",
],
rules: {
"@eslint-community/eslint-comments/no-unused-disable": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
"import/prefer-default-export": "error",
"no-console": "warn",
"no-restricted-imports": ["error", { patterns: ["./server/"] }],
"no-shadow": "off", // @typescript-eslint/no-shadow
"unicorn/filename-case": "off", // use default export name
"unicorn/no-array-reduce": "off",
"unicorn/no-null": "off", // part of multiple apis
"unicorn/no-useless-undefined": ["error", { checkArrowFunctionBody: false }], // @typescript-eslint/no-empty-function
"unicorn/number-literal-case": "off", // incompatible with prettier
"unicorn/prefer-global-this": "off", // incompatible with react-native
"unicorn/switch-case-braces": ["error", "avoid"], // consistently avoid braces
},
overrides: [
{
files: ["src/**"],
extends: [
"universe/native",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:react-native/all",
],
rules: {
"react-native/no-raw-text": [
"error",
{
skip: [
"ActionButton",
"AlertDialog.Description",
"AlertDialog.Title",
"Button",
"Heading",
"Link",
"LinkButton",
"SizableText",
"SubmitButton",
"Select.Label",
],
},
],
"import/no-unresolved": "off", // handled by bundler
"unicorn/prefer-top-level-await": "off", // unsupported in react-native
},
},
{
files: [...nodeFiles, "server/**"],
extends: ["universe/node", "plugin:n/recommended", "plugin:drizzle/all"],
rules: {
"drizzle/enforce-delete-with-where": ["error", { drizzleObjectName: "database" }],
"drizzle/enforce-update-with-where": ["error", { drizzleObjectName: "database" }],
"import/no-unresolved": "off", // handled by bundler
"n/no-missing-import": "off", // handled by bundler
"unicorn/prefer-top-level-await": "off", // unsupported in cjs
},
},
{
files: ["**/*.cjs"],
rules: { "@typescript-eslint/no-require-imports": "off" },
},
{
files: ["server/test/**"],
extends: ["plugin:@vitest/legacy-all"],
rules: {
"@vitest/no-hooks": "off",
"@vitest/prefer-expect-assertions": [
"warn",
{ onlyFunctionsWithExpectInLoop: true, onlyFunctionsWithExpectInCallback: true },
],
"@vitest/require-top-level-describe": "off",
},
},
],
ignorePatterns: [
".expo/",
"build/",
"coverage/",
"dist/",
"expo-env.d.ts",
"generated/",
"public/",
"server/app/",
"server/drizzle/",
],
};