Skip to content

Bug: [no-unused-vars] 'Component' is defined but never used #5571

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

Closed
4 tasks done
muuvmuuv opened this issue Aug 30, 2022 · 4 comments · Fixed by #5574
Closed
4 tasks done

Bug: [no-unused-vars] 'Component' is defined but never used #5571

muuvmuuv opened this issue Aug 30, 2022 · 4 comments · Fixed by #5574
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@muuvmuuv
Copy link

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

does not work

Repro Code

import { Component } from '@angular/core'

@Component({
  selector: 'app-root',
  template: '',
})
export class AppComponent {}

ESLint Config

{
  "root": true,
  "overrides": [
    // ....
    {
      "files": ["*.ts"],
      "parser": "@typescript-eslint/parser",
      "plugins": ["tsdoc", "@typescript-eslint"],
      "extends": [
        "plugin:@typescript-eslint/recommended",
        "plugin:@typescript-eslint/recommended-requiring-type-checking",
        "plugin:@typescript-eslint/strict"
      ],
      "parserOptions": {
        "project": ["tsconfig.lint.json"]
      },
      "rules": {
        "tsdoc/syntax": "error"
      }
    },
    {
      "files": ["src/**/*.ts"],
      "env": {
        "node": false,
        "browser": true
      },
      "extends": [
        "plugin:compat/recommended",
        "plugin:@angular-eslint/recommended",
        "plugin:@angular-eslint/template/process-inline-templates"
      ],
      "parserOptions": {
        "project": ["tsconfig.lint.json"]
      },
      "rules": {
        "no-alert": "error",
        "no-debugger": "error",
        "no-console": "error",
        "@angular-eslint/component-class-suffix": [
          "error",
          {
            "suffixes": ["Page", "Component"]
          }
        ],
        "@typescript-eslint/explicit-module-boundary-types": [
          "off",
          {
            "allowHigherOrderFunctions": true
          }
        ]
      }
    },
    {
      "files": ["*.js", "*.mjs", "*.ts", "*.mts", "*.html"],
      "extends": ["prettier"]
    }
  ]
}

tsconfig

{
  "$schema": "http://json.schemastore.org/tsconfig",
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "./dist/out-tsc",
    "strict": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitOverride": true,
    // "noPropertyAccessFromIndexSignature": true,
    "noFallthroughCasesInSwitch": true,
    "forceConsistentCasingInFileNames": true,
    "strictPropertyInitialization": true,
    "strictNullChecks": true,
    "esModuleInterop": true,
    "downlevelIteration": true,
    "sourceMap": true,
    "declaration": false,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "ES2020",
    "module": "ESNext",
    "lib": ["ESNext", "DOM"]
  },
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}

Expected Result

Recognise imported "Component" as "experimentalDecorators".

Actual Result

'Component' is defined but never used.eslint@typescript-eslint/no-unused-vars

Additional Info

No response

Versions

package version
@typescript-eslint/eslint-plugin ^5.36.0
@typescript-eslint/parser ^5.36.0
TypeScript <4.8.0
ESLint ^8.23.0
node 17
@muuvmuuv muuvmuuv added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Aug 30, 2022
@stefnedelchevbrady
Copy link

I also confirm the issue. After updating to 5.36.1 I started experiencing it so I had to revert back to 5.35

@bradzacher
Copy link
Member

bradzacher commented Aug 30, 2022

As per our contributing guide - please don't comment in the form of "+1" or "I also have this issue". Such comments just create notification spam and add little value.
Instead use the reaction feature to add a 👍 to the original post and click "subscribe" in the right-hand bar to receive updates about the issue.

@bradzacher
Copy link
Member

bradzacher commented Aug 30, 2022

It looks like we introduced a regression with exported decorators and TS<4.8

@bradzacher bradzacher added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Aug 30, 2022
@typescript-eslint typescript-eslint deleted a comment from BryanHunt Aug 30, 2022
@typescript-eslint typescript-eslint locked and limited conversation to collaborators Aug 30, 2022
@bradzacher
Copy link
Member

Fix has been released as https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.36.1

@typescript-eslint typescript-eslint unlocked this conversation Aug 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants