-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
fix(eslint-plugin): [component-selector] enhance check for prefix and… #1250
fix(eslint-plugin): [component-selector] enhance check for prefix and… #1250
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 74dbacd. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 7 targets
Sent with 💌 from NxCloud. |
Codecov Report
@@ Coverage Diff @@
## main #1250 +/- ##
==========================================
+ Coverage 88.11% 88.18% +0.07%
==========================================
Files 164 164
Lines 3172 3175 +3
Branches 512 513 +1
==========================================
+ Hits 2795 2800 +5
+ Misses 261 260 -1
+ Partials 116 115 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
TODO: this change allows for selectors like |
@@ -88,7 +88,7 @@ export default createESLintRule<Options, MessageIds>({ | |||
return; | |||
} | |||
|
|||
if (!prefixValidator.apply(this, [nameValue])) { | |||
if (!prefixValidator.apply(this, [nameValue]) || !styleValidator) { |
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.
Does this styleValidator need to be called as a function with the nameValue?
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.
You're right, it does. However, I'm currently looking to see if this change can be reverted. I better understand the importance of the suffix logic in prefix
, and might look to bring it back.
@@ -302,9 +312,9 @@ export const invalid = [ | |||
}) | |||
class Test {} | |||
`, | |||
messageId: messageIdStyleFailure, | |||
messageId: messageIdStyleAndPrefixFailure, |
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.
Note: the reported error for this invalid case has changed to the new error message. Although it's not incorrect, the former is more concise for this particular case. I think the only way to retain the original message is to move the style logic inside the prefix validator to its own validator (which I did attempt in a previous commit). However, this will result in a more complex conditional in the rule when determining which message to report.
LMK your thoughts!
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.
This seems acceptable to me as a non breaking change while addressing the original issue.
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.
thanks for digging into this!
@@ -302,9 +312,9 @@ export const invalid = [ | |||
}) | |||
class Test {} | |||
`, | |||
messageId: messageIdStyleFailure, | |||
messageId: messageIdStyleAndPrefixFailure, |
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.
This seems acceptable to me as a non breaking change while addressing the original issue.
4b4b290
to
56b0670
Compare
@JamesHenry ready for review. LMK what you think. |
56b0670
to
74dbacd
Compare
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.
Thank you @abaran30 (and @sandikbarr)! And sorry for the delay in reviewing
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@angular-eslint/builder](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`15.1.0` -> `15.2.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2fbuilder/15.1.0/15.2.0) | | [@angular-eslint/eslint-plugin](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`15.1.0` -> `15.2.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2feslint-plugin/15.1.0/15.2.0) | | [@angular-eslint/eslint-plugin-template](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`15.1.0` -> `15.2.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2feslint-plugin-template/15.1.0/15.2.0) | | [@angular-eslint/schematics](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`15.1.0` -> `15.2.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2fschematics/15.1.0/15.2.0) | | [@angular-eslint/template-parser](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`15.1.0` -> `15.2.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2ftemplate-parser/15.1.0/15.2.0) | --- ### Release Notes <details> <summary>angular-eslint/angular-eslint (@​angular-eslint/builder)</summary> ### [`v15.2.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/builder/CHANGELOG.md#​1520-httpsgithubcomangular-eslintangular-eslintcomparev1510v1520-2023-01-14) [Compare Source](angular-eslint/angular-eslint@v15.1.0...v15.2.0) **Note:** Version bump only for package [@​angular-eslint/builder](https://github.com/angular-eslint/builder) </details> <details> <summary>angular-eslint/angular-eslint (@​angular-eslint/eslint-plugin)</summary> ### [`v15.2.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#​1520-httpsgithubcomangular-eslintangular-eslintcomparev1510v1520-2023-01-14) [Compare Source](angular-eslint/angular-eslint@v15.1.0...v15.2.0) ##### Bug Fixes - **eslint-plugin:** \[component-selector] enhance check for prefix and kebab-case ([#​1250](angular-eslint/angular-eslint#1250)) ([16827e4](angular-eslint/angular-eslint@16827e4)) - **eslint-plugin:** \[no-inputs-metadata-property] do not report on directive composition API ([#​1248](angular-eslint/angular-eslint#1248)) ([539cf9f](angular-eslint/angular-eslint@539cf9f)) - update typescript-eslint packages to v5.45.1 ([#​1239](angular-eslint/angular-eslint#1239)) ([abb7f79](angular-eslint/angular-eslint@abb7f79)) - update typescript-eslint packages to v5.48.1 ([#​1255](angular-eslint/angular-eslint#1255)) ([11151d1](angular-eslint/angular-eslint@11151d1)) ##### Features - **eslint-plugin:** \[require-localize-metadata] option to require meaning ([#​1235](angular-eslint/angular-eslint#1235)) ([b870123](angular-eslint/angular-eslint@b870123)) </details> <details> <summary>angular-eslint/angular-eslint (@​angular-eslint/eslint-plugin-template)</summary> ### [`v15.2.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/eslint-plugin-template/CHANGELOG.md#​1520-httpsgithubcomangular-eslintangular-eslintcomparev1510v1520-2023-01-14) [Compare Source](angular-eslint/angular-eslint@v15.1.0...v15.2.0) ##### Bug Fixes - update typescript-eslint packages to v5.45.1 ([#​1239](angular-eslint/angular-eslint#1239)) ([abb7f79](angular-eslint/angular-eslint@abb7f79)) - update typescript-eslint packages to v5.48.1 ([#​1255](angular-eslint/angular-eslint#1255)) ([11151d1](angular-eslint/angular-eslint@11151d1)) ##### Features - **eslint-plugin-template:** \[i18n] option to require i18n metadata meaning ([#​1234](angular-eslint/angular-eslint#1234)) ([4ef0290](angular-eslint/angular-eslint@4ef0290)) - **eslint-plugin-template:** \[no-interpolation-in-attributes] new rule added ([#​1242](angular-eslint/angular-eslint#1242)) ([977cb3a](angular-eslint/angular-eslint@977cb3a)) </details> <details> <summary>angular-eslint/angular-eslint (@​angular-eslint/schematics)</summary> ### [`v15.2.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/schematics/CHANGELOG.md#​1520-httpsgithubcomangular-eslintangular-eslintcomparev1510v1520-2023-01-14) [Compare Source](angular-eslint/angular-eslint@v15.1.0...v15.2.0) ##### Bug Fixes - update dependency eslint to v8.29.0 ([#​1246](angular-eslint/angular-eslint#1246)) ([10c14d2](angular-eslint/angular-eslint@10c14d2)) - update dependency eslint to v8.31.0 ([#​1262](angular-eslint/angular-eslint#1262)) ([db89c85](angular-eslint/angular-eslint@db89c85)) - update dependency ignore to v5.2.1 ([#​1237](angular-eslint/angular-eslint#1237)) ([609e06b](angular-eslint/angular-eslint@609e06b)) - update dependency ignore to v5.2.4 ([#​1263](angular-eslint/angular-eslint#1263)) ([a220e0c](angular-eslint/angular-eslint@a220e0c)) - update typescript-eslint packages to v5.45.1 ([#​1239](angular-eslint/angular-eslint#1239)) ([abb7f79](angular-eslint/angular-eslint@abb7f79)) - update typescript-eslint packages to v5.48.1 ([#​1255](angular-eslint/angular-eslint#1255)) ([11151d1](angular-eslint/angular-eslint@11151d1)) </details> <details> <summary>angular-eslint/angular-eslint (@​angular-eslint/template-parser)</summary> ### [`v15.2.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/template-parser/CHANGELOG.md#​1520-httpsgithubcomangular-eslintangular-eslintcomparev1510v1520-2023-01-14) [Compare Source](angular-eslint/angular-eslint@v15.1.0...v15.2.0) ##### Features - **eslint-plugin-template:** \[no-interpolation-in-attributes] new rule added ([#​1242](angular-eslint/angular-eslint#1242)) ([977cb3a](angular-eslint/angular-eslint@977cb3a)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDIuMCIsInVwZGF0ZWRJblZlciI6IjM0LjEwMi4wIn0=--> Co-authored-by: cabr2-bot <cabr2.help@gmail.com> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1733 Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org> Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org> Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
...kebab-case
Resolves #318
This pull request contains the following changes to accommodate the discussion had in #318:
component-selector
for invalid prefix and case