-
Notifications
You must be signed in to change notification settings - Fork 320
Expand file tree
/
Copy patheslint.config.mjs
More file actions
142 lines (129 loc) · 4.46 KB
/
Copy patheslint.config.mjs
File metadata and controls
142 lines (129 loc) · 4.46 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
// @ts-check
import { globalIgnores } from 'eslint/config'
import { defineConfig } from 'eslint-config-hyoban'
import checkI18nJson from './plugins/eslint/eslint-check-i18n-json.js'
import recursiveSort from './plugins/eslint/eslint-recursive-sort.js'
// In flat config, some large generated folders slipped through. To be extra safe,
// put ignores in a top-level config object first, then append the rest.
const rootIgnores = globalIgnores([
'apps/ssr/src/index.html.ts',
'apps/ssr/public/**',
'apps/web/public/**',
'packages/docs/public/**',
'apps/mobile/ios/**',
'apps/mobile/android/**',
'apps/mobile/.expo/**',
'apps/mobile/expo-env.d.ts',
'apps/mobile/modules/photo-masonry/ios/Tests/Fixtures/**',
])
const hyobanConfig = await defineConfig(
{
formatting: false,
lessOpinionated: true,
preferESM: false,
react: true,
},
{
languageOptions: {
parserOptions: {
emitDecoratorMetadata: true,
experimentalDecorators: true,
},
},
// TailwindCSS v4 usually has no config file. Silence the plugin's
// config resolution warning by explicitly disabling auto-resolution.
settings: {
tailwindcss: {
// ESLint plugin will not attempt to resolve tailwind config
// which avoids repeated "Cannot resolve default tailwindcss config path" warnings.
config: false,
},
},
rules: {
'unicorn/prefer-response-static-json': 0,
'unicorn/no-abusive-eslint-disable': 0,
'@typescript-eslint/triple-slash-reference': 0,
'unicorn/prefer-math-trunc': 'off',
'unicorn/no-static-only-class': 'off',
'@eslint-react/no-clone-element': 0,
// TailwindCSS v4 not support
'tailwindcss/no-custom-classname': 0,
'@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 0,
// NOTE: Disable this temporarily
'react-compiler/react-compiler': 0,
'no-restricted-syntax': 0,
'@typescript-eslint/no-unsafe-function-type': 0,
// 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/no-array-callback-reference': 'off',
'ts/no-use-before-define': 'off',
'style/multiline-ternary': 'off',
'e18e/prefer-static-regex': 'off',
'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.',
},
],
},
},
// @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: ['**/*.tsx'],
rules: {
'@stylistic/jsx-self-closing-comp': 'error',
},
},
// Backend framework isn't React — disable React-specific hooks rule there.
{
files: ['be/packages/framework/**/*.{ts,tsx}'],
rules: {
'react-hooks/rules-of-hooks': 'off',
},
},
// Expo inlines EXPO_PUBLIC_* env vars only through literal `process.env` access,
// and expo-router route files / page definitions must export non-component values.
{
files: ['apps/mobile/**/*.{ts,tsx}'],
rules: {
'node/prefer-global/process': 'off',
'react-refresh/only-export-components': 'off',
},
},
// Redundant but harmless: keep a local ignore in case this block is used standalone somewhere
globalIgnores(['apps/ssr/src/index.html.ts', 'apps/ssr/public/**', 'apps/web/public/**', 'packages/docs/public/**']),
)
export default [
// Ensure ignores are applied globally before any other configs
rootIgnores,
...hyobanConfig,
]