angular-eslint
angular-eslint copied to clipboard
[@angular-eslint/template/i18n] Prevent spaces at beginning/end of translated strings
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
- [x] I have tried restarting my IDE and the issue persists.
- [x] I have updated to the latest supported version of the packages and checked my
ng version
output per the instructions given here.