UNPKG

@blaze-money/eslint-plugin-spark

Version:

ESLint plugin for Spark project with custom rules

52 lines (31 loc) 1.74 kB
# @blaze-money/eslint-plugin-spark ESLint plugin for the Spark project with custom rules to enforce coding standards. ## Rules ### matching-email-translation-structure This rule ensures that all email translation files have the same structure as the English translation file (`en.messages.ts`). It checks for missing keys and extra keys in non-English translation files. #### Usage The rule is automatically enabled in the Spark ESLint configuration. It will run when you run `yarn lint` or when you commit changes (via the pre-commit hook). You can also run the rule manually with: ```bash yarn email:check-translations ``` #### How it works The rule: 1. Identifies all `.messages.ts` files in the email translation directories 2. Skips the English translation file (`en.messages.ts`) as it's the reference 3. Compares each non-English translation file with the English one 4. Reports any missing keys or extra keys #### Fixing issues When the rule reports missing keys, you should add those keys to the translation file with appropriate translations. When it reports extra keys, you should either: 1. Add those keys to the English translation file if they should be there 2. Remove them from the non-English translation file if they're no longer needed ## Adding new translations When adding new email templates or messages: 1. Add the new keys to `en.messages.ts` first 2. Run `yarn email:check-translations` to identify which translation files need to be updated 3. Add the missing keys to all non-English translation files ## Development To add new rules to this plugin: 1. Create a new rule file in the `rules` directory 2. Add the rule to the `index.js` file 3. Update the ESLint configuration to enable the rule