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

[@angular-eslint/template/i18n] Prevent spaces at beginning/end of translated strings #1793

Open
2 tasks done
aleesaan opened this issue May 1, 2024 · 0 comments
Open
2 tasks done
Labels
package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer

Comments

@aleesaan
Copy link
Contributor

aleesaan commented May 1, 2024

Description and reproduction of the issue
Sometimes linting rules can break the code into new lines in a way that adds spaces to the string to be translated, for example:

<button
  type="button"
  i18n
>
  Change password
</button>

Would end up in the string " Change password " being extracted, whereas I'd just want "Change password".
I tried to use boundTextAllowedPattern for this, but I can't get it to work; from what I see in the source code we also trim() the string we test, so maybe that's why I can't get it to work.

Do you have suggestions on how to solve this issue?

Versions

package version
@angular-eslint/eslint-plugin-template 17.2.1
@angular-eslint/template-parser 17.2.1
@typescript-eslint/parser 6.21.0
ESLint 8.57.0
node 18.18
# Please run `npx ng version` in your project and paste the full output here:
     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.3.3
Node: 18.20.1
Package Manager: npm 10.5.0
OS: darwin arm64

Angular: 17.3.3
... animations, cdk, cli, common, compiler, compiler-cli, core
... elements, forms, language-service, localize
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.3
@angular-devkit/build-angular   17.3.3
@angular-devkit/core            17.3.3
@angular-devkit/schematics      17.3.3
@schematics/angular             17.3.3
rxjs                            7.8.1
typescript                      5.4.4
zone.js                         0.14.4
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.
@aleesaan aleesaan added package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant