Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no-unused-vars] global never used #2558

Closed
Tansito opened this issue Sep 14, 2020 · 1 comment
Closed

[no-unused-vars] global never used #2558

Tansito opened this issue Sep 14, 2020 · 1 comment
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@Tansito
Copy link

Tansito commented Sep 14, 2020

Repro

Updating @typescript-eslint/eslint-plugin and @typescript-eslint/parser from 3.10.0 to 4.1.0 the linter is showing the next message:

warning  'global' is defined but never used  @typescript-eslint/no-unused-vars

Our code is the next:

import { Tab } from './Tab';

customElements.define('custom-tab', Tab);

declare global {
  interface HTMLElementTagNameMap {
    'custom-tab': Tab;
  }
}

And we solved the problem thanks to the next rule:

"rules": {
  "@typescript-eslint/no-unused-vars": [
    "error",
    {
      "varsIgnorePattern": "^global$"
    }
  ]
}

Our current rules for the project: https://github.com/IBMResearch/eslint-config-ibmresearch

Expected Result

How in this case the global reserved word references to the global scope, this message should not be shown as a warning.

Actual Result

The plugin is showing global as an unused variable.

Versions

package version
@typescript-eslint/eslint-plugin 4.1.0
@typescript-eslint/parser 4.1.0
TypeScript 4.0.2
ESLint 7.9.0
node 14.10.1
@Tansito Tansito added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Sep 14, 2020
@bradzacher
Copy link
Member

#2523 et al.

Please use the issue search.

@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for maintainers to take a look labels Sep 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants