Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
181 lines (175 loc) · 5.26 KB
/
Copy patheslint.config.js
File metadata and controls
181 lines (175 loc) · 5.26 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import eslintConfigPrettier from 'eslint-config-prettier'
import pluginImport from 'eslint-plugin-import'
import unusedImports from 'eslint-plugin-unused-imports'
import globals from 'globals'
import tseslint from 'typescript-eslint'
export default tseslint.config(
// Global ignores
{
ignores: [
'**/dist/*',
'**/.next/*',
'**/.contentlayer/*',
'**/node_modules/*',
// Vendored Plunk: upstream code, linted upstream.
'freebuff/plunk/**',
],
},
// CLI package: enforce using CliProcessEnv instead of ProcessEnv
{
files: ['cli/src/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@codebuff/common/env-process',
importNames: ['getProcessEnv', 'processEnv'],
message:
'CLI should use getCliEnv() from "../utils/env" or "./env" instead of getProcessEnv() from common. This ensures CLI uses CliEnv type.',
},
],
patterns: [
{
group: ['@codebuff/common/types/contracts/env'],
importNames: ['ProcessEnv'],
message:
'CLI should use CliEnv from "../types/env" instead of ProcessEnv from common.',
},
],
},
],
},
},
// SDK package: enforce using SdkProcessEnv instead of ProcessEnv
{
files: ['sdk/src/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@codebuff/common/env-process',
importNames: ['getProcessEnv', 'processEnv'],
message:
'SDK should use getSdkEnv() from "./env" instead of getProcessEnv() from common. This ensures SDK uses SdkEnv type.',
},
],
patterns: [
{
group: ['@codebuff/common/types/contracts/env'],
importNames: ['ProcessEnv'],
message:
'SDK should use SdkEnv from "./types/env" instead of ProcessEnv from common.',
},
],
},
],
},
},
// Base config for JS/TS files
{
files: ['**/*.{js,mjs,cjs,ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: {
...globals.node,
},
},
plugins: {
import: pluginImport,
'unused-imports': unusedImports,
'@typescript-eslint': tseslint.plugin,
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
},
},
},
rules: {
'import/order': [
'warn',
{
groups: [
'builtin',
'external',
'internal',
['parent', 'sibling', 'index'],
'type',
],
alphabetize: { order: 'asc', caseInsensitive: true },
'newlines-between': 'always',
},
],
'import/no-unresolved': 'off', // Disabled: TypeScript/Bun handles module resolution; this rule produces false positives with path aliases
'import/no-duplicates': 'warn',
'unused-imports/no-unused-imports': 'warn',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
},
],
'no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_', // Allow unused args prefixed with _
varsIgnorePattern: '^_', // Allow unused vars prefixed with _
args: 'none', // Don't check function arguments (common in callbacks with required signatures)
},
],
'react-hooks/exhaustive-deps': 'off', // Disabled: plugin not configured for all packages
'@next/next/no-img-element': 'off', // Disabled: plugin not configured for all packages
},
},
// Freebuff admin (S62): every /web/admin page is built on
// `@/components/admin-ui`. Keep the old kits out so a page cannot drift back.
{
files: ['freebuff/web/src/app/web/admin/**/*.{js,mjs,cjs,ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: [
'@/vly/components/ui',
'@/vly/components/ui/*',
'@/components/ui',
'@/components/ui/*',
'**/vly/components/ui',
'**/vly/components/ui/*',
],
message:
'Admin pages use @/components/admin-ui, not the vly ui kit (S62). `@/components/ui/*` resolves to it too.',
},
{
group: ['**/ads/console/ui', '**/ads/console/ui.tsx'],
message:
'Admin pages use @/components/admin-ui, not the ads console kit (S62).',
},
{
group: [
'**/admin/AdminPageFrame',
'**/admin/AdminPageFrame.tsx',
],
message:
'Use PageColumn and PageHeader from @/components/admin-ui (S62).',
},
],
},
],
},
},
// Prettier config (last to override formatting rules)
eslintConfigPrettier,
)