[i18n] $localize raises eslint errors
See original GitHub issueBug Report
Affected Package
i18n
Is this a regression?
don’t know
Description
ESLint is complaining for no-unsafe-assignment and no-unsafe-call when using $localize.
Minimal Reproduction
const localizedString = $localize`This string should be translated`;
Exception or Error
error Unsafe assignment of an any value @typescript-eslint/no-unsafe-assignment
error Unsafe any typed template tag @typescript-eslint/no-unsafe-call
Your Environment
Angular Version:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 11.2.13
Node: 14.15.1
OS: darwin x64
Angular: 11.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1102.13
@angular-devkit/build-angular 0.1102.13
@angular-devkit/core 11.2.13
@angular-devkit/schematics 11.2.13
@angular/cdk 11.2.13
@angular/cli 11.2.13
@angular/material 11.2.13
@schematics/angular 11.2.13
@schematics/update 0.1102.13
rxjs 6.6.7
typescript 4.1.5
Anything else relevant?
eslintrc.json
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:prettier/recommended"
],
"rules": {
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/restrict-template-expressions": [
"off",
{
"allowNumber": true
}
],
"arrow-parens": ["off", "always"],
"curly": ["error", "multi-line"],
"import/order": "off",
"max-len": [
"error",
{
"code": 200
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
},
{
"files": ["*.html"],
"excludedFiles": ["*inline-template-*.component.html"],
"extends": ["plugin:prettier/recommended"],
"rules": {
"prettier/prettier": ["error", { "parser": "html" }]
}
}
]
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How To Open Source An ESLint Plugin for Localization
I recently open sourced an ESLint plugin for OkCupid called eslint-plugin-i18n-lingui . The plugin is an extension for ESLint's core static code analysis...
Read more >Introducing a fully extendable eslint plugin for JSON i18n ...
Introducing a fully extendable eslint plugin for JSON i18n translation files ... formatting syntax errors (e.g. JSON), malformed or missing message keys, ...
Read more >i18next warn or lint on missing key for a language (not the ...
While @tudor answer work for eslint in javascript format, it wasn't in .json format. Here is the solution: Plugin: eslint-plugin-i18n-json
Read more >Proposal: locale option and meta.messages revision #9870
The purpose is to support the localization of error messages. This proposal includes two things. Adding the way to specify a locale.
Read more >Advanced Features: Internationalized Routing - Next.js
Next.js has built-in support for internationalized (i18n) routing since v10.0.0 . You can provide a list of locales, the default locale, and domain-specific ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m sorry to hear that you couldn’t find the problem in your setup, but thanks for updating me on the status of this issue. I think we should close this issue, since there doesn’t appear to be a problem with Angular itself. Feel free to open a new one if you manage to find a reproduction that you can share.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.