You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/cli/src/lingui-compile.ts
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ export type CliCompileOptions = {
22
22
watch?: boolean
23
23
namespace?: string
24
24
workersOptions: WorkersOptions
25
+
outputPrefix?: string
25
26
}
26
27
27
28
exportasyncfunctioncommand(
@@ -113,6 +114,7 @@ type CliArgs = {
113
114
config?: string
114
115
debounce?: number
115
116
workers?: number
117
+
outputPrefix?: string
116
118
}
117
119
118
120
if(require.main===module){
@@ -135,6 +137,10 @@ if (require.main === module) {
135
137
"--debounce <delay>",
136
138
"Debounces compilation for given amount of milliseconds"
137
139
)
140
+
.option(
141
+
"--output-prefix <prefix>",
142
+
"Add a custom string to the beginning of compiled files (header/prefix). Useful for tools like linters or coverage directives. Defaults to '/*eslint-disable*/'"
143
+
)
138
144
.on("--help",function(){
139
145
console.log("\n Examples:\n")
140
146
console.log(
@@ -165,6 +171,7 @@ if (require.main === module) {
Copy file name to clipboardExpand all lines: website/docs/ref/cli.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,6 +172,7 @@ lingui compile
172
172
[--namespace <namespace>]
173
173
[--watch [--debounce <delay>]]
174
174
[--workers]
175
+
[--output-prefix <prefix>]
175
176
```
176
177
177
178
Once you have all the catalogs ready and translated, you can use this command to compile all the catalogs into minified JS/TS files. It compiles message catalogs located in the [`path`](/ref/conf#catalogs) directory and generates minified JavaScript files. The resulting file is a string that is parsed into a plain JS object using `JSON.parse`.
@@ -250,6 +251,33 @@ Worker threads can significantly improve performance on large projects. However,
250
251
251
252
A larger worker pool also increases memory usage. Adjust this value for your project to achieve the best performance.
Adds a custom string to the beginning of compiled message catalogs (a header/prefix). By default, Lingui adds `/*eslint-disable*/` to prevent linters from reporting issues in generated files.
257
+
258
+
Use this option forother tools that rely on header directives (e.g., different linters, coverage tools, or formatters). Provide the full prefix exactly as it should appearin the output.
259
+
260
+
**Default value:**`/*eslint-disable*/`
261
+
262
+
**Examples:**
263
+
264
+
```shell
265
+
# For Oxlint
266
+
lingui compile --output-prefix "/*oxlint-disable*/"
267
+
268
+
# For Biome
269
+
lingui compile --output-prefix "/*biome-ignore lint: auto-generated*/"
One limitation of checking formissing translations is that the English message catalog typically does not require translations since our source code isin English. This issue can be resolved by configuring the [`sourceLocale`](/ref/conf#sourcelocale) in the configuration file.
0 commit comments