-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.js
More file actions
248 lines (223 loc) · 7.94 KB
/
eslint.config.js
File metadata and controls
248 lines (223 loc) · 7.94 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
import tseslint from "typescript-eslint"
import linguiPlugin from "eslint-plugin-lingui"
export default [
{ ignores: ["src/routeTree.gen.ts", "src/locales/**/*", "src/i18n/locales.ts", "dist/**", "src/**/*.test.*", "src/**/*.d.ts"] },
{
files: ["src/**/*.{ts,tsx}"],
languageOptions: {
parser: tseslint.parser,
parserOptions: { ecmaFeatures: { jsx: true } },
},
plugins: { lingui: linguiPlugin },
rules: {
"lingui/no-unlocalized-strings": [
"error",
{
ignoreNames: [
// --- HTML / JSX structural attributes ---
// Any prop/identifier containing "className" (e.g. className, bodyClassName, headerClassName)
{ regex: { pattern: "className", flags: "i" } },
"style",
"id",
"type",
"href",
"src",
"key",
"name",
"accept",
"method",
"action",
"target",
"rel",
"pattern",
"autoComplete",
"encType",
"sandbox",
"scrolling",
"charset",
"role",
"loading",
"htmlFor",
"data-testid",
{ regex: { pattern: "^data-" } },
// Identifier-like prop/variable ending with "id" or "Id" (e.g. pageid, pageId, studentId)
{ regex: { pattern: "^[A-Za-z0-9_]*(id|Id)$" } },
// --- SVG attributes ---
"fill",
"d",
"viewBox",
"strokeLinecap",
"strokeDasharray",
// --- Radix UI / shadcn layout props ---
"variant",
"size",
"align",
"side",
// CSS position keys used as object keys mapping to class strings (e.g. sheetVariants)
"top",
"bottom",
"left",
"right",
// --- Router / navigation props ---
"to",
"step",
"tab",
// --- Form / input props (non-visible values) ---
"defaultValue",
"value",
// Form field name constants (e.g. const RADIO_NAME = "renderStrategy")
"RADIO_NAME",
"radioName",
// Image processing preview pane focus key (ImageProcessingPreviewFocus — not user-visible)
"previewFocus",
// --- CSS class & color props (never user-visible) ---
"rootMargin",
"color",
"hex",
"textColor",
"bgLight",
"borderColor",
"borderDark",
"iconColor",
"colorClass",
"bgColor",
"imageSrc",
"pdfUrl",
"adtUrl",
"comingSoon",
{ regex: { pattern: "Class$" } },
// --- Data labels (technical CSS descriptions, pipeline labels — not user-facing prose) ---
"label",
// --- Pipeline / config identifiers ---
"slug",
"stageSlug",
"promptName",
"node",
"mode",
"direction",
"fromStage",
"toStage",
"category",
// --- CSS utility class variable names (StageSidebar layout constants) ---
"gap",
"showLabel",
"showFlex",
"flex1",
// --- iframe srcdoc / injected style strings (never user-visible) ---
"srcdoc",
"interactiveStyles",
"textContent",
// --- TanStack Query cache keys ---
"queryKey",
// --- File dialog / download props (Tauri + browser) ---
"defaultPath",
"download",
"filters",
"extensions",
// --- React internals ---
"displayName",
// --- i18n locale metadata (intentionally not translated — must stay in native script) ---
"LOCALE_LABEL_MESSAGES",
"LOCALE_FLAGS",
],
ignoreFunctions: [
// --- Console / logging ---
"console.*",
"*.log",
"*.warn",
"*.error",
"*.info",
"*.debug",
// --- Error constructors ---
"Error",
"TypeError",
"RangeError",
// --- Module system ---
"require",
// --- API / fetch calls (URL strings are never translatable) ---
"request",
"fetch",
// --- DOM manipulation ---
"document.createElement",
"*.setAttribute",
"*.removeAttribute",
"*.getAttribute",
"*.querySelector",
"*.querySelectorAll",
"*.closest",
"*.append",
"*.prepend",
"*.setProperty",
"*.open",
"*.getContext",
// --- DOM event types ---
"*.addEventListener",
"*.removeEventListener",
"*.scrollIntoView",
// --- String / array operations (used for internal comparisons) ---
"*.replace",
"*.startsWith",
"*.endsWith",
"*.includes",
// --- URL / search params manipulation ---
"*.set",
"*.get",
"*.delete",
"new URL",
// --- TanStack Router route definitions ---
"createFileRoute",
// --- TanStack Form (field paths are identifiers, not UI copy) ---
"*.setFieldValue",
// --- CSS class composition utilities ---
"cn",
"cva",
"clsx",
// --- Math / formatting (unit suffixes in template literals) ---
"*.toFixed",
],
ignore: [
// project brand name (intentional non-translatable literal)
"^ADT Studio$",
// npm package names and module paths (e.g. "@tanstack/react-router")
"^@?[a-zA-Z0-9_-]+(/[a-zA-Z0-9_.-]+)+",
// TypeScript import() / type strings using path aliases (e.g. "@/api/client")
"^@/[a-zA-Z0-9_.-]+(/[a-zA-Z0-9_.-]+)*$",
// locale codes (e.g. "en", "pt-BR", "es")
"^[a-z]{2}(-[A-Z]{2})?$",
// absolute URLs
"^https?://",
// relative URL paths (e.g. "/api", "/books/${label}")
"^/[a-zA-Z0-9_-]",
// Tailwind CSS classes, internal identifiers, and status values
// (all-lowercase-no-spaces: bg-gray-600, hover:bg-white, gap-2.5, "success", "error", "done")
"^[a-z][a-z0-9._:-]*$",
// Multi-class Tailwind strings (space-separated tokens, e.g. "bg-red-600 text-white hover:bg-red-700")
"^[a-z][a-z0-9._:/-]*( [a-z!][a-z0-9._:/-]*)+$",
// Hex color values (e.g. "#ffffff", "#2563eb")
"^#[0-9a-fA-F]+$",
// CSS dimension values (e.g. "10px", "1.5rem", "48px")
"^[0-9]",
// React Server Components directives (shadcn boilerplate)
"^use (client|server)$",
// Brand name (never translated)
"^ADT Studio$",
// Data URIs (e.g. "data:image/png;base64,...")
"^data:",
// Byte-size literals (e.g. "12 KB", "1.5MB", "2 gb", "10tb")
"^[0-9]+(?:\\.[0-9]+)?\\s?(?:B|KB|MB|GB|TB|b|kb|mb|gb|tb)$",
// HTML fragments used in innerHTML assignments (e.g. `<div id="content">`)
"^<[a-z]",
// Closing HTML tags used in string operations (e.g. "</section>")
"^</[a-z]",
// CSS selectors and rule blocks (e.g. `[data-id="..."]`, `body[data-editable=...] {...}`)
"^[\\[.]?[a-z].*\\{",
"^\\[data-",
// Underscore-prefixed internal ID fragments (e.g. "_tx" in data-id template literals)
"^_[a-z]",
],
},
],
"lingui/t-call-in-function": "error",
},
},
]