I've got the following eslint error:
Promises must be handled appropriately or explicitly marked as ignored with the
voidoperator.eslint@typescript-eslint/no-floating-promises
with this code:
this.router.navigate(['/']);
the router is imported like this: import { Router } from '@angular/router'; and assigned in the constructor of the class.
My eslint config:
module.exports = {
extends: [
"plugin:@angular-eslint/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// "plugin:@angular-eslint/template/process-inline-templates",
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
sourceType: 'module',
ecmaVersion: 2020,
},
plugins: ['@typescript-eslint', '@angular-eslint', 'prettier'],
rules: {
"prettier/prettier": [
"error",
{
"printWidth": 140,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true,
"endOfLine": "lf"
},
],
},
};
Is my config wrong oder what's the problem? I feel like router.navigate shouldn't be an eslint error in an angular project.