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

fix(lint/useConst): handle reads before assignment and improve docs #2584

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

Conaclos
Copy link
Member

Summary

Fix #2575

I also took the opportunity of fixing an issue I discovered when reading the code:
The rule should not report an implicitly initialized variable that is read before its assignment.
The following example was previously reported:

let a;
a;
a = 0;

Test Plan

I added 3 tests and updated the snapshots.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Apr 24, 2024
Copy link

codspeed-hq bot commented Apr 24, 2024

CodSpeed Performance Report

Merging #2584 will not alter performance

Comparing conaclos/useConst/improve-rule (77a6815) with main (15ca346)

Summary

✅ 93 untouched benchmarks

@Conaclos Conaclos force-pushed the conaclos/useConst/improve-rule branch 4 times, most recently from 00e1765 to bf1969d Compare April 24, 2024 16:01
@github-actions github-actions bot added the A-CLI Area: CLI label Apr 24, 2024
@Conaclos Conaclos requested a review from a team April 24, 2024 16:02
@Conaclos Conaclos force-pushed the conaclos/useConst/improve-rule branch from bf1969d to 52997e3 Compare April 24, 2024 16:06
@github-actions github-actions bot added the A-Changelog Area: changelog label Apr 24, 2024
@Conaclos Conaclos force-pushed the conaclos/useConst/improve-rule branch from 52997e3 to 6d25cc9 Compare April 24, 2024 16:22
@github-actions github-actions bot added the A-Project Area: project label Apr 24, 2024
@Conaclos Conaclos force-pushed the conaclos/useConst/improve-rule branch from 6d25cc9 to 77a6815 Compare April 24, 2024 16:24
@Conaclos Conaclos merged commit b24b44c into main Apr 25, 2024
15 checks passed
@Conaclos Conaclos deleted the conaclos/useConst/improve-rule branch April 25, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 False positive in useConst
1 participant