deno_lint icon indicating copy to clipboard operation
deno_lint copied to clipboard

`no-unused-vars` doesn't work in JSX and TSX files

Open Skalman opened this issue 1 year ago • 1 comments

Lint name

no-unused-vars

Code Snippet

const foo = 42;

Expected Result

foo is never used

no-unused-vars rule is triggered regardless of the file type (extension).

Actual Result

No lint error

Additional Info

This is an intentional duplicate of #712. That issue was closed, since the rule intentionally skips JSX files to avoid false positives around the factory functions.

However, deno_lint should have access to deno.jsonc and perhaps tsconfig.json, and should be able to figure out what the factory imports are.

Version

deno 1.23.0 (release, x86_64-unknown-linux-gnu) v8 10.4.132.5 typescript 4.7.2

Skalman avatar Jun 27 '22 21:06 Skalman

Just checking out deno using fresh today and this tripped me up when I set up my editor with deno, I thought I had done something wrong as this was the error I introduced to test it out in editor linting.

I agree that skipping jsx/tsx doesn't seem to make much sense and makes me wonder what other may be skipped (now or in the future).

rshurts avatar Feb 24 '23 00:02 rshurts