eslint-plugin-react icon indicating copy to clipboard operation
eslint-plugin-react copied to clipboard

Add note about not needing jsx-no-undef with TS / typescript-eslint

Open karlhorky opened this issue 4 months ago • 1 comments

Hi @ljharb, hope everything is going well! 👋

Quick PR to add an additional 2 cases of when to not use react/jsx-no-undef

  1. when using TypeScript, since it has better checks than ESLint no-undef rules

  2. the @typescript-eslint/parser parser allows for usage of ESLint's built-in no-undef without react/jsx-no-undef:

    • https://typescript-eslint.io/play/#ts=5.7.2&fileType=.tsx&code=DwCQpgNhD2AEB2BDAtmAvAIgFLQBbw1gHoA%2BAbgCgg&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQHYHsBaWXAE0QDN0pFpp9pJwwBfEFoA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
    Screenshot 2025-08-03 at 13 56 31

    This applies to:

    1. .tsx files (as demonstrated in the typescript-eslint Playground link)
    2. .jsx or .js files - also without "allowJs": true or "checkJs": true in tsconfig.json.

karlhorky avatar Aug 03 '25 11:08 karlhorky