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

fix(i18n): No longer throws exception when compiler returns null i18n description #892

Merged
merged 3 commits into from Feb 13, 2022

Conversation

jamjarvi
Copy link
Contributor

@jamjarvi jamjarvi commented Feb 8, 2022

Closes #891.

Note, I attempted to include a test case for this specific issue, but the returned location info was always out of alignment with the annotated test case location, I believe because my test case always contained a template compilation issue.

@@ -422,7 +422,7 @@ function isBooleanLike(value: string): value is 'false' | 'true' {
}

function isEmpty(value: string) {
return value.trim().length === 0;
return value == null || value.trim().length === 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth to have something like the following?

if (!!value) {
  return value.trim().length === 0;
}

return true;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose that could save us some unnecessary calls to trim, so it might be slightly more performant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, but removed the double negation to pass their lint rule:
image

@codecov
Copy link

codecov bot commented Feb 13, 2022

Codecov Report

Merging #892 (88b32c9) into master (5f874d9) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #892      +/-   ##
==========================================
+ Coverage   86.33%   86.34%   +0.01%     
==========================================
  Files         145      145              
  Lines        2715     2717       +2     
  Branches      436      437       +1     
==========================================
+ Hits         2344     2346       +2     
  Misses        220      220              
  Partials      151      151              
Flag Coverage Δ
unittest 86.34% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/eslint-plugin-template/src/rules/i18n.ts 93.68% <ø> (+0.13%) ⬆️

@JamesHenry JamesHenry merged commit d349149 into angular-eslint:master Feb 13, 2022
@JamesHenry
Copy link
Member

Thanks @jamjarvi!

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Feb 17, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@angular-eslint/builder](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`13.0.1` -> `13.1.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2fbuilder/13.0.1/13.1.0) |
| [@angular-eslint/eslint-plugin](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`13.0.1` -> `13.1.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2feslint-plugin/13.0.1/13.1.0) |
| [@angular-eslint/eslint-plugin-template](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`13.0.1` -> `13.1.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2feslint-plugin-template/13.0.1/13.1.0) |
| [@angular-eslint/schematics](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`13.0.1` -> `13.1.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2fschematics/13.0.1/13.1.0) |
| [@angular-eslint/template-parser](https://github.com/angular-eslint/angular-eslint) | devDependencies | minor | [`13.0.1` -> `13.1.0`](https://renovatebot.com/diffs/npm/@angular-eslint%2ftemplate-parser/13.0.1/13.1.0) |

---

### Release Notes

<details>
<summary>angular-eslint/angular-eslint (@&#8203;angular-eslint/builder)</summary>

### [`v13.1.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/builder/CHANGELOG.md#&#8203;1310-httpsgithubcomangular-eslintangular-eslintcomparev1301v1310-2022-02-13)

[Compare Source](angular-eslint/angular-eslint@v13.0.1...v13.1.0)

**Note:** Version bump only for package [@&#8203;angular-eslint/builder](https://github.com/angular-eslint/builder)

#### [13.0.1](angular-eslint/angular-eslint@v13.0.0...v13.0.1) (2021-11-19)

**Note:** Version bump only for package [@&#8203;angular-eslint/builder](https://github.com/angular-eslint/builder)

</details>

<details>
<summary>angular-eslint/angular-eslint (@&#8203;angular-eslint/eslint-plugin)</summary>

### [`v13.1.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#&#8203;1310-httpsgithubcomangular-eslintangular-eslintcomparev1301v1310-2022-02-13)

[Compare Source](angular-eslint/angular-eslint@v13.0.1...v13.1.0)

##### Bug Fixes

-   rule docs links in create-eslint-rule utils ([#&#8203;907](angular-eslint/angular-eslint#907)) ([94f6e21](angular-eslint/angular-eslint@94f6e21))

#### [13.0.1](angular-eslint/angular-eslint@v13.0.0...v13.0.1) (2021-11-19)

**Note:** Version bump only for package [@&#8203;angular-eslint/eslint-plugin](https://github.com/angular-eslint/eslint-plugin)

</details>

<details>
<summary>angular-eslint/angular-eslint (@&#8203;angular-eslint/eslint-plugin-template)</summary>

### [`v13.1.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/eslint-plugin-template/CHANGELOG.md#&#8203;1310-httpsgithubcomangular-eslintangular-eslintcomparev1301v1310-2022-02-13)

[Compare Source](angular-eslint/angular-eslint@v13.0.1...v13.1.0)

##### Bug Fixes

-   **eslint-plugin-template:** \[i18n] do not throw when compiler returns null i18n description ([#&#8203;892](angular-eslint/angular-eslint#892)) ([d349149](angular-eslint/angular-eslint@d349149))
-   rule docs links in create-eslint-rule utils ([#&#8203;907](angular-eslint/angular-eslint#907)) ([94f6e21](angular-eslint/angular-eslint@94f6e21))

##### Features

-   **eslint-plugin-template:** \[i18n] add checkDuplicateId option ([#&#8203;868](angular-eslint/angular-eslint#868)) ([edaf46f](angular-eslint/angular-eslint@edaf46f))
-   update angular/compiler to v13.2.2 ([#&#8203;834](angular-eslint/angular-eslint#834)) ([9847978](angular-eslint/angular-eslint@9847978))

#### [13.0.1](angular-eslint/angular-eslint@v13.0.0...v13.0.1) (2021-11-19)

**Note:** Version bump only for package [@&#8203;angular-eslint/eslint-plugin-template](https://github.com/angular-eslint/eslint-plugin-template)

</details>

<details>
<summary>angular-eslint/angular-eslint (@&#8203;angular-eslint/schematics)</summary>

### [`v13.1.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/schematics/CHANGELOG.md#&#8203;1310-httpsgithubcomangular-eslintangular-eslintcomparev1301v1310-2022-02-13)

[Compare Source](angular-eslint/angular-eslint@v13.0.1...v13.1.0)

##### Bug Fixes

-   update dependency ignore to v5.2.0 ([#&#8203;913](angular-eslint/angular-eslint#913)) ([5480102](angular-eslint/angular-eslint@5480102))

##### Features

-   update angular/compiler to v13.2.2 ([#&#8203;834](angular-eslint/angular-eslint#834)) ([9847978](angular-eslint/angular-eslint@9847978))

#### [13.0.1](angular-eslint/angular-eslint@v13.0.0...v13.0.1) (2021-11-19)

##### Bug Fixes

-   **schematics:** auto update eslint-plugin-import as part of v13 ng update ([#&#8203;836](angular-eslint/angular-eslint#836)) ([705e83b](angular-eslint/angular-eslint@705e83b))

</details>

<details>
<summary>angular-eslint/angular-eslint (@&#8203;angular-eslint/template-parser)</summary>

### [`v13.1.0`](https://github.com/angular-eslint/angular-eslint/blob/HEAD/packages/template-parser/CHANGELOG.md#&#8203;1310-httpsgithubcomangular-eslintangular-eslintcomparev1301v1310-2022-02-13)

[Compare Source](angular-eslint/angular-eslint@v13.0.1...v13.1.0)

**Note:** Version bump only for package [@&#8203;angular-eslint/template-parser](https://github.com/angular-eslint/template-parser)

#### [13.0.1](angular-eslint/angular-eslint@v13.0.0...v13.0.1) (2021-11-19)

**Note:** Version bump only for package [@&#8203;angular-eslint/template-parser](https://github.com/angular-eslint/template-parser)

</details>

---

### Configuration

📅 **Schedule**: 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, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1172
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

i18nMissingDescription rule throws exception if compiler returns null i18n description
3 participants