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

feat(linter): implement no-undef #672

Merged
merged 8 commits into from
Aug 7, 2023

Conversation

makotot
Copy link
Contributor

@makotot makotot commented Jul 31, 2023

Closes #619

I have tried to implement https://eslint.org/docs/latest/rules/no-undef

Note: Unsupported items are excluded from test cases in this PR by commenting them out..

@github-actions github-actions bot added the A-linter Area - Linter label Jul 31, 2023
@makotot makotot changed the title feat(linter): implement no-undef feat(linter): implement no-undef Jul 31, 2023
@makotot makotot marked this pull request as ready for review July 31, 2023 18:20
Copy link
Member

@Boshen Boshen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I think we can make this performant by using run_once, and then loop the global unreferenced variables and print their references. Would you like to give this a try?

crates/oxc_linter/src/rules/eslint/no_undef.rs Outdated Show resolved Hide resolved
crates/oxc_linter/src/rules/eslint/no_undef.rs Outdated Show resolved Hide resolved
@Boshen Boshen marked this pull request as draft August 2, 2023 03:45
@DonIsaac
Copy link
Contributor

DonIsaac commented Aug 3, 2023

This looks great to me, ready for review @mysteryven?

@makotot
Copy link
Contributor Author

makotot commented Aug 3, 2023

Fixed to use run_once method.ctx.semantic().nodes() is still used for typeof operator checks though.
Can I ask to review it again?

mysteryven
mysteryven previously approved these changes Aug 3, 2023
Boshen pushed a commit that referenced this pull request Aug 5, 2023
Closes #685 

Intend to use this in the following ways in #672.
```rs
let node = ctx.nodes().get_node(reference.node_id());
if !self.type_of && has_typeof_operator(node, ctx) {
    return;
}
```
@makotot
Copy link
Contributor Author

makotot commented Aug 7, 2023

I think it is ready for review again, so I'll remove the draft status.

@makotot makotot marked this pull request as ready for review August 7, 2023 12:41
@makotot makotot requested review from Boshen and mysteryven August 7, 2023 12:41
@Boshen Boshen merged commit c6245f8 into oxc-project:main Aug 7, 2023
@Boshen
Copy link
Member

Boshen commented Aug 7, 2023

Nice work! I hope you enjoyed the long journey 😁

@makotot makotot deleted the linter/rules/no-undef branch August 7, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linter Area - Linter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(linter): eslint/no-undef
4 participants