Skip to content

JS: fix unused 'React' variable FP#557

Merged
semmle-qlci merged 5 commits into
masterfrom
unknown repository
Nov 30, 2018
Merged

JS: fix unused 'React' variable FP#557
semmle-qlci merged 5 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Nov 28, 2018

Copy link
Copy Markdown

Eliminates var React = require('react') as a js/unused-local-variable FP in the presence of JSX elements.

The first commit is a refactoring to make the fix simpler.

This does not whitelist the var { React } = require("probably-react");, it seems to be quite messy to support that potential corner case (or am I missing an obvious solution?).

Performance is fine, and results are plenty.

@ghost ghost added the JS label Nov 28, 2018
@ghost ghost self-requested a review as a code owner November 28, 2018 12:28
Comment thread javascript/ql/src/Declarations/UnusedVariable.ql Outdated
@ghost ghost added WIP This is a work-in-progress, do not merge yet! and removed WIP This is a work-in-progress, do not merge yet! labels Nov 28, 2018
@ghost

ghost commented Nov 29, 2018

Copy link
Copy Markdown
Author

The simplification is safe, both in terms of results and performance.

The only additional kind of FP that is eliminated is var React = require('react/addons');

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants