-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy patheslint.config.mjs
More file actions
165 lines (161 loc) · 4.63 KB
/
eslint.config.mjs
File metadata and controls
165 lines (161 loc) · 4.63 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// @ts-check
import { fixupPluginRules } from "@eslint/compat"
import { defineConfig } from "eslint-config-hyoban"
import reactNative from "eslint-plugin-react-native"
import path from "pathe"
import checkI18nJson from "./plugins/eslint/eslint-check-i18n-json.js"
import noDebug from "./plugins/eslint/eslint-no-debug.js"
import packageJsonExtend from "./plugins/eslint/eslint-package-json.js"
import recursiveSort from "./plugins/eslint/eslint-recursive-sort.js"
export default defineConfig(
{
formatting: false,
lessOpinionated: true,
ignores: [
"resources/**",
"apps/mobile/android/**",
"apps/mobile/ios/**",
"apps/mobile/.expo",
"apps/mobile/native/build/**",
"**/generated-routes.ts",
],
preferESM: false,
tailwindCSS: {
order: false,
},
},
{
settings: {
tailwindcss: {
whitelist: ["center"],
},
},
plugins: {
"no-debug": noDebug,
},
rules: {
"no-debug/no-debug-stack": "error",
"tailwindcss/classnames-order": "off",
"tailwindcss/enforces-negative-arbitrary-values": "off",
"tailwindcss/enforces-shorthand": "off",
"tailwindcss/migration-from-tailwind-2": "off",
"tailwindcss/no-arbitrary-value": "off",
"tailwindcss/no-contradicting-classname": "off",
"tailwindcss/no-custom-classname": "off",
"tailwindcss/no-unnecessary-arbitrary-value": "off",
"@eslint-react/no-clone-element": 0,
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": 0,
"@eslint-react/dom/no-flush-sync": 1,
"@eslint-react/hooks-extra/no-unnecessary-use-callback": "warn",
"unicorn/no-array-callback-reference": 0,
"no-restricted-syntax": 0,
"no-restricted-globals": [
"error",
{
name: "location",
message:
"Since you don't use the same router instance in electron and browser, you can't use the global location to get the route info. \n\n" +
"You can use `useLocaltion` or `getReadonlyRoute` to get the route info.",
},
],
// disable react compiler rules for now
"react-hooks/no-unused-directives": "off",
"react-hooks/static-components": "off",
"react-hooks/use-memo": "off",
"react-hooks/component-hook-factories": "off",
"react-hooks/preserve-manual-memoization": "off",
"react-hooks/immutability": "off",
"react-hooks/globals": "off",
"react-hooks/refs": "off",
"react-hooks/set-state-in-effect": "off",
"react-hooks/error-boundaries": "off",
"react-hooks/purity": "off",
"react-hooks/set-state-in-render": "off",
"react-hooks/unsupported-syntax": "off",
"react-hooks/config": "off",
"react-hooks/gating": "off",
"unicorn/require-module-specifiers": "off",
},
},
// use correct tailwind config for eslint
{
settings: {
tailwindcss: {
config: path.join(import.meta.dirname, "apps/desktop/tailwind.config.ts"),
},
},
},
{
files: ["apps/ssr/**/*"],
settings: {
tailwindcss: {
config: path.join(import.meta.dirname, "apps/ssr/tailwind.config.ts"),
},
},
},
{
files: ["apps/mobile/**/*"],
settings: {
tailwindcss: {
config: path.join(import.meta.dirname, "apps/mobile/tailwind.config.ts"),
},
},
},
{
files: ["**/*.tsx"],
rules: {
"@stylistic/jsx-self-closing-comp": "error",
},
},
// @ts-expect-error
{
files: ["locales/**/*.json"],
plugins: {
"recursive-sort": recursiveSort,
"check-i18n-json": checkI18nJson,
},
rules: {
"recursive-sort/recursive-sort": "error",
"check-i18n-json/valid-i18n-keys": "error",
"check-i18n-json/no-extra-keys": "error",
},
},
{
files: ["package.json", "apps/**/package.json", "packages/**/package.json"],
plugins: {
"package-json-extend": packageJsonExtend,
},
rules: {
"package-json-extend/ensure-package-version": "error",
"package-json-extend/no-duplicate-package": "error",
"package-json/require-type": 0,
},
},
{
files: ["**/*.{js,ts,tsx}"],
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "node:path",
message:
"For better cross-platform compatibility, please use 'pathe' instead of 'node:path'",
},
],
},
],
},
},
{
plugins: {
// @ts-expect-error
"react-native": fixupPluginRules(reactNative),
},
files: ["apps/mobile/**/*"],
rules: {
"react-native/no-inline-styles": "warn",
},
},
)