1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

ESlint Angular - no-unused-vars hits type definition

Discussão em 'Angular' iniciado por mat.hudak, Setembro 27, 2024 às 17:13.

  1. mat.hudak

    mat.hudak Guest

    I'm upgrading/refactoring an Angular project (to Angular 8, Electron 6, Ionic 4) and we decided to switch from TSLint to ESLint.

    I setup some rules and they are running but I can't get a rid off the no-unused-vars warning for type definition. When I run linting I'll get this warning for OperatorFunction and Observable which is obviously not an issue.

    import { OperatorFunction, Observable, timer } from 'rxjs';
    import { tap } from 'rxjs/operators';

    export function executeDelayed<T>(fn: () => void, delayTime: number): OperatorFunction<T, T> {
    return function executeDelayedOperation(source: Observable<T>): Observable<T> {
    //...
    }
    }


    .eslintrc.js file uses this configuration

    module.exports = {
    "env": {
    "browser": true,
    "es6": true,
    "node": true
    },
    "extends": [
    "eslint:recommended",
    "plugin:mad:typescript-eslint/eslint-recommended",
    "plugin:prettier/recommended"
    ],
    "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
    },
    "plugins": [
    "@typescript-eslint"
    ],
    "rules": {
    "no-unused-vars": [
    "warn",
    {
    "vars": "local",
    "ignoreSiblings": true,
    "args": "after-used",
    "argsIgnorePattern": "res|next|^err"
    }
    ],
    "no-use-before-define": [
    "error",
    {
    "functions": true,
    "classes": true
    }
    ]
    }
    };


    I went trough multiple similar questions here but wasn't able to find the solution. Any idea? Switching back to TSLint is NOT an option.

    Continue reading...

Compartilhe esta Página