-
Notifications
You must be signed in to change notification settings - Fork 245
feat(eslint-plugin): [require-localize-metadata] add requireCustomId option #2430
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
feat(eslint-plugin): [require-localize-metadata] add requireCustomId option #2430
Conversation
…dation Added two more options to report errors if: - Custom ID is not present - Custom ID is present but it doesn't follow the allowed pattern - Default value is not provided Change in details: - Added new configuration options and error messages for reporting. - Create and use a `validate` function that receives the input string and a type to validate optionally it can receive a pattern to validate custom id. - The core of the `validate` function is a regular expression with named group, I have followed how Angular manages metadata when using `$localize` - Added new valid and invalid tests cases to cover the changes. New config after changes: - Added `requireCustomId` - `boolean` - default is `false` - Added `requireDefaultValue` - `boolean` - default is `false` - Added `boundTextAllowedPattern` - `string` - No default value. It expects to get a string that can be converted to regular expression to test custom id. I have used the same name that already exists in `@angular-eslint/template-parser`.
163679a
to
a1dce40
Compare
View your CI Pipeline Execution ↗ for commit acb1795.
☁️ Nx Cloud last updated this comment at |
2ca088b
to
da06715
Compare
packages/eslint-plugin/tests/rules/require-localize-metadata/cases.ts
Outdated
Show resolved
Hide resolved
da06715
to
e570d0f
Compare
@tcorral how do you feel about this approach as an alternative? |
@igord CI not passing yet |
@JamesHenry It looks good to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the CI commands locally before pushing, there are still multiple failures
ee9f8b9
to
a1dce40
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2430 +/- ##
==========================================
+ Coverage 92.85% 92.86% +0.01%
==========================================
Files 200 200
Lines 4169 4203 +34
Branches 973 984 +11
==========================================
+ Hits 3871 3903 +32
- Misses 229 231 +2
Partials 69 69
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Similar to #2186, this PR adds one new rule
requireCustomId
that can be enabled:true
orcustom_id
validationIt also refactors
$localize
metadata parsing to be closer to the way that@angular/localize
does it