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] Request: Only check for string or unknown typed attributes #1565

Open
2 tasks done
Samuel-Therrien-Beslogic opened this issue Oct 30, 2023 · 2 comments
Labels
package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer

Comments

@Samuel-Therrien-Beslogic
Copy link

Samuel-Therrien-Beslogic commented Oct 30, 2023

Description and reproduction of the issue

{
  "rules": {
    "@angular-eslint/template/i18n": "error"
  }
}
<my-component cardType="info"></my-component>

Where cardType is

type CardTypes = 'default' | 'error' | 'warning' | 'info'

The rule could leverage typescript to only check for attributes of type string, any, unknown or any union containing those. Literal string unions should be omitted.
This would allow for many less false-positives with default configurations.

Versions

package version
@angular-eslint/eslint-plugin-template 15.2.1
@angular-eslint/template-parser 15.2.1
@typescript-eslint/parser 5.62.0
ESLint 8.52.0
node 18.14.0
     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 16.1.8
Node: 18.14.0
Package Manager: npm 9.4.2
OS: win32 x64

Angular: 16.1.9
... common, compiler-cli, core, forms, language-service
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1601.8
@angular-devkit/build-angular   16.1.8
@angular-devkit/core            16.2.8
@angular-devkit/schematics      16.2.8
@angular/cdk                    16.1.8
@angular/cli                    16.1.8
@angular/material               16.1.8
@schematics/angular             16.2.8
ng-packagr                      16.1.0
rxjs                            7.8.1
typescript                      4.9.5
  • 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.
@Samuel-Therrien-Beslogic Samuel-Therrien-Beslogic added package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer labels Oct 30, 2023
@json-derulo
Copy link
Contributor

I don't really understand what you are asking for. Do you want a new rule, and if yes, what problem should it solve? Or do you want the existing @angular-eslint/template/i18n rule to be adjusted, like the title suggests?

@Samuel-Therrien-Beslogic
Copy link
Author

I don't really understand what you are asking for. Do you want a new rule, and if yes, what problem should it solve? Or do you want the existing @angular-eslint/template/i18n rule to be adjusted, like the title suggests?

I forgot to substitute <rule> when I originally opened the issue. I'm asking for an adjustment of the existing rule to reduce false-positives by inferring that literal string typed inputs don't need to be translated.

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

2 participants