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

[react/jsx-uses-vars]: False negative on HTML elements used in JSX #2916

Merged
merged 1 commit into from Oct 1, 2021
Merged

[react/jsx-uses-vars]: False negative on HTML elements used in JSX #2916

merged 1 commit into from Oct 1, 2021

Conversation

karlhorky
Copy link
Contributor

@karlhorky karlhorky commented Feb 2, 2021

This PR is to add a failing test for the following situation:

// False Negative:
// The `div` parameter below is not recognized as an unused variable
function App(div) {
  return <div />
}

This also happens with other variables (eg. variables declared separately):

const div = 123;

export function App() {
  return <div />;
}

Incorrectly reported here: typescript-eslint/typescript-eslint#2985

@karlhorky karlhorky changed the title Add failing test [react/jsx-uses-vars]: False negative on HTML elements used in JSX Feb 2, 2021
@karlhorky karlhorky marked this pull request as ready for review February 2, 2021 12:23
@ljharb
Copy link
Member

ljharb commented Feb 2, 2021

Thanks; there's some work that should likely be done here with our variableUtil.

@ljharb ljharb added the bug label Aug 9, 2021
@ljharb
Copy link
Member

ljharb commented Oct 1, 2021

This test is now passing; it was fixed in #3070. Will merge to close.

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2021

Codecov Report

Merging #2916 (783d4cd) into master (a9f0b95) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2916   +/-   ##
=======================================
  Coverage   97.55%   97.55%           
=======================================
  Files         118      118           
  Lines        7855     7855           
  Branches     2801     2801           
=======================================
  Hits         7663     7663           
  Misses        192      192           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9f0b95...783d4cd. Read the comment docs.

@ljharb ljharb merged commit 783d4cd into jsx-eslint:master Oct 1, 2021
@karlhorky
Copy link
Contributor Author

Great, thanks! Will look for this in the next patch (7.26.1) or minor (7.27.0)

@karlhorky karlhorky deleted the patch-1 branch October 2, 2021 17:05
@ljharb
Copy link
Member

ljharb commented Oct 2, 2021

It’ll be a minor, since there’s already new rules landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants