Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: 5.27.0 regression: @typescript-eslint/no-unused-vars wrongly reports the jsxFactory set in tsconfig.json #5153

Closed
@lydell

Description

@lydell

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.

Issue Description

I use Preact and have this in my tsconfig.json:

    "jsx": "react",
    "jsxFactory": "h",
    "jsxFragmentFactory": "Fragment"

I use it like so:

import { h, Fragment } from "preact";

export default function MyComponent() {
  return <><h1>Hello, world!</h1></>;
}

It used to result in no errors. With version 5.27.0, it reports h and Fragment as unused.

I’ve searched through the issue tracker, and also in TypeScript’s and Preact’s issue trackers, but couldn’t find anything. I apologize if I missed something, or this is a misunderstanding on my side that just happened to work before!

Reproduction Repository Link

https://github.com/lydell/typescript-eslint-preact-issue

Repro Steps

  1. clone the repo
  2. npm ci
  3. npm test

Versions

package version
@typescript-eslint/eslint-plugin 5.27.0
@typescript-eslint/parser 5.27.0
TypeScript 4.7.3
ESLint 8.17.0
node 18.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't workinggood first issueGood for newcomerspackage: parserIssues related to @typescript-eslint/parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions