Skip to content

[no-unused-var] varsIgnorePattern not working for this module definition #2648

@HolgerJeromin

Description

@HolgerJeromin
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

module.exports = {
    "root": true,
    "parser": "@typescript-eslint/parser",
    "plugins": [        "@typescript-eslint"    ],
    "rules": {
        "no-unused-vars": "off",
        "@typescript-eslint/no-unused-vars": ["error", {
            "vars": "all",
            "varsIgnorePattern": "Hmi",
            "args": "none"
        }]
    }

}
module Hmi {
    export interface myType  {
    }
    export function getType(): Hmi.myType | null {
        return null; 
     // return Hmi.System.getMyType();
    }
}

Or even shorter:

module Hmi {
    export class myClass {
    }
    console.log(Hmi.myClass);  // Register call in reality
}

Expected Result

No rule violation.

  1. Because the module is used.
  2. Because I even added the name Hmi into varsIgnorePattern

Actual Result

.\node_modules\.bin\eslint.cmd  file.ts

file.ts
  1:8  error  'Hmi' is defined but never used  @typescript-eslint/no-unused-vars

✖ 1 problem (1 error, 0 warnings)

Additional Info
This examples are working!

export module Hmi {   // <-- export added!
    export interface myType  {
    }
    export function getType(): Hmi.myType | null {
        return null;
    }
}
module Hmi {
    export interface myType  {
    }
    export function getType():  null {  // <-- myType removed
        return null;
    }
}

Versions

  "@typescript-eslint/eslint-plugin": "4.4.0",
  "@typescript-eslint/parser": "4.4.0",
  "eslint": "6.8.0", and "7.10.0"
  "typescript": "4.0.3",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy