Skip to content

Commit

Permalink
chore: fix prettier and eslint warnings (#2137)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar authored Dec 27, 2024
1 parent 8020427 commit 0637345
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test:tsd": "jest -c jest.config.types.js",
"test:all": "yarn test && yarn test:integration && yarn test:e2e && yarn test:tsd",
"lint:types": "tsc",
"lint:eslint": "eslint './packages",
"lint:eslint": "eslint ./packages",
"lint:all": "yarn lint:eslint && yarn lint:types",
"prettier": "prettier --write '**/*.{ts,tsx,js,jsx}'",
"prettier:check": "prettier --check '**/*.{ts,tsx,js,jsx}'",
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/src/lingui-compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export async function command(
},
})

if (!options.allowEmpty && locale !== config.pseudoLocale && missingMessages.length > 0) {
if (
!options.allowEmpty &&
locale !== config.pseudoLocale &&
missingMessages.length > 0
) {
console.error(
chalk.red(
`Error: Failed to compile catalog for locale ${chalk.bold(locale)}!`
Expand Down
45 changes: 21 additions & 24 deletions packages/cli/src/test/compile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,41 +101,38 @@ msgstr ""
}
)

it(
"Should allow empty translation for pseudo locale",
async () => {
expect.assertions(4)
it("Should allow empty translation for pseudo locale", async () => {
expect.assertions(4)

const rootDir = await createFixtures({
"/test": {
"en.po": `
const rootDir = await createFixtures({
"/test": {
"en.po": `
msgid "Hello World"
msgstr "Hello World"
`,
"pl.po": `
"pl.po": `
msgid "Hello World"
msgstr ""
`,
},
})
},
})

const config = getConfig(rootDir, 'pl')
const config = getConfig(rootDir, "pl")

await mockConsole(async (console) => {
const result = await command(config, {
allowEmpty: false,
})
const actualFiles = readFsToJson(config.rootDir)
await mockConsole(async (console) => {
const result = await command(config, {
allowEmpty: false,
})
const actualFiles = readFsToJson(config.rootDir)

expect(actualFiles["pl.js"]).toBeTruthy()
expect(actualFiles["en.js"]).toBeTruthy()
expect(actualFiles["pl.js"]).toBeTruthy()
expect(actualFiles["en.js"]).toBeTruthy()

const log = getConsoleMockCalls(console.error)
expect(log).toBeUndefined()
expect(result).toBeTruthy()
})
}
)
const log = getConsoleMockCalls(console.error)
expect(log).toBeUndefined()
expect(result).toBeTruthy()
})
})

it("Should show missing messages verbosely when verbose = true", async () => {
expect.assertions(2)
Expand Down

0 comments on commit 0637345

Please sign in to comment.