Skip to content

Bug: [@typescript-eslint/no-unused-vars] False positive on export-equals syntax #6383

Closed
@Yoten

Description

@Yoten

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=4.9.3&sourceType=module&code=JYOwLgpgTgZghgYwgAgCoQM5gJLmvJZAbwFgAoZZGAe2oC5kspQBzAbnIF9yIAPAB2pQwyALxpMOPLEQQ2QA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaWXWZRAE0IDcBDaVDSfAMxcgBpxtIABAFwCeABxQBjaAEth-QiniTc-APQFipclToN0URNGj5okbgF8QpoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEMCisJye6FYemArugDTg2R4sACacMbOvCFEAVmT40oQ0RgBK6ErFScCxCQDkRrBQMwatAN3QApTUQCyIsa0oduJ2hscr0ASSIsmLCIbG68-LR4AIaYAOboeBIaAKyQHlBEsACi8MzYRFmYQZihXOGKkJm+SKjI0MwAgkQAnmwAZlGoJOWm6EJWAMII8OgBZJQdXT20JBx1ePpiqAMAFujQANbj7GXpkJqcmNDo9lEhE53d-AC+INdAA

Repro Code

interface TestInterface {
  foo: string;
}
export = TestInterface;

ESLint Config

module.exports = {
  parser: "@typescript-eslint/parser",
  rules: {
    "no-unused-vars": "off",
    "@typescript-eslint/no-unused-vars": "error"
  },
};

tsconfig

{
  "compilerOptions": {
    "composite": true,
    "module": "commonjs",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "target": "es5",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "removeComments": false,
    "strictNullChecks": true,
    "sourceMap": false
  }
}

Expected Result

No errors given.

Actual Result

"'TestInterface' is defined but never used."

Additional Info

In the course of upgrading typescript-eslint from 3.9.1 --> 5.49.0 I started getting a ton of "no-used-var" failures from some of our older projects that still use the old "export = X", "import X = require(...)" syntaxes.

I'm guessing this happened with the scope analysis changes from 4.0? Regardless, I know it's a bit silly considering how out of date "export =" is, but I wasn't sure if they're supposed to be supported or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workingpackage: scope-managerIssues related to @typescript-eslint/scope-managerscope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions