Custom eslint rules for mosaik projects
npm install @breadstone-infrastructure/eslint-rules| Package Status | Source |
|----------------|--------|
|  | infra/eslint-rules |
> Custom ESLint rules for the Mosaik Nx workspace and Breadstone projects.
> Enforces code style, consistency, and best practices for TypeScript/JavaScript and localization.
---
Part of the monorepo mosaik
Package path: infra/eslint-rules
Version: see npm
License: MIT
---
``bash`
yarn add -D @breadstone-infrastructure/eslint-rulesor
npm install --save-dev @breadstone-infrastructure/eslint-rules
---
Add the rules to your ESLint configuration:
`js`
// .eslintrc.js
module.exports = {
extends: [
// ...other configs
],
plugins: [
'@breadstone-infrastructure/eslint-rules'
],
rules: {
'@breadstone-infrastructure/eslint-rules/region-in-classes': 'warn',
'@breadstone-infrastructure/eslint-rules/region-in-interfaces': 'warn',
'@breadstone-infrastructure/eslint-rules/command-naming': 'error',
'@breadstone-infrastructure/eslint-rules/duplicate-keys': 'error',
'@breadstone-infrastructure/eslint-rules/empty-values': 'error',
'@breadstone-infrastructure/eslint-rules/key-consistency': 'error',
'@breadstone-infrastructure/eslint-rules/missing-translations': 'error',
'@breadstone-infrastructure/eslint-rules/multiple-key-usage': 'error',
'@breadstone-infrastructure/eslint-rules/unused-keys': 'error',
'@breadstone-infrastructure/eslint-rules/class-extends-implements-newline': 'warn'
}
};
---
| Rule Name | Description |
|----------------------------------|----------------------------------------------------------------------------------------------|
| region-in-classes | Require #region/#endregion tags for Fields, Ctor, Properties, Methods in classes |region-in-interfaces
| | Require #region/#endregion tags for Properties and Methods in interfaces |command-naming
| | Enforce [verb][Object]Command naming for commands |duplicate-keys
| | Detect duplicate translation keys in resource files |empty-values
| | Detect translation keys with empty values |key-consistency
| | Ensure translation keys are consistent across locales |missing-translations
| | Detect missing translations in resource files |multiple-key-usage
| | Detect inconsistent usage of translation keys |unused-keys
| | Detect unused translation keys in resource files |class-extends-implements-newline
| | Ensure extends and implements are on separate lines in class declarations |_component-documentation
| | (WIP) Enforce JSDoc comments for components |
---
- region-in-classes
- region-in-interfaces
- command-naming
- See source files in src/Rules/Resources/ for translation resource rules.
---
- Use these rules in conjunction with @breadstone-infrastructure/eslint-config for best results.
- Integrate into your Nx workspace for consistent linting.
---
`bash``
yarn nx run eslint-rules:publish
---
MIT © Breadstone
---