Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(condo): DOMA-10737 improve lint-i18n-translations.js #5530

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

pahaz
Copy link
Member

@pahaz pahaz commented Nov 22, 2024

No description provided.

@@ -3,55 +3,59 @@ const fetch = require('node-fetch')

const { getAppServerUrl } = require('@open-condo/cli')

program.option('-f, --filter <names...>', 'Filters apps by name')
program.option('-s, --sleep <number>', 'Sleep interval between polling in ms', /\d{1,12}/, '3000')
program.option('-t, --timeout <number>', 'Max polling time in ms', /\d{1,12}/, '120000')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RegExp is deprecated

Copy link
Contributor

@Alllex202 Alllex202 Nov 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we don't use a "RESET_PASSWORD" message type, so you should remove translations for that type

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I want to add this check to the linter

const filePath = path.join(messageDirPath, file)
if (file.endsWith('.njk')) {
try {
await fs.access(filePath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about to nest code even more and wrap every single line in try-catch? Because right now the code reads too easily :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to refactor this part heavily, right now its heavy 400-liner, no one can read and understand.
I hate this kind of files, because you cannot even tell somebody to fix something in it.

It's like @open-condo/next, very heavy and hard to understand files with unstructured code...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can partially fix it with naming (for example this utils scans for push / email templates, you can call it loadNotificationTemplates or something, remove nested try catches here, panic is enough for bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants