Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

refactor(rome_js_analyze): noFallthroughSwitchClause handle block statements #4695

Merged
merged 1 commit into from
Jul 14, 2023
Merged

refactor(rome_js_analyze): noFallthroughSwitchClause handle block statements #4695

merged 1 commit into from
Jul 14, 2023

Conversation

Conaclos
Copy link
Contributor

Summary

This PR fixes an issue with noFallthroughSwitchClause that reported code with block statements:

switch x {
  // this case was reported by the rule
   case 0: {
    f();
    break;
  }
  case 1:
    f();
}

Test Plan

New test included.

@netlify
Copy link

netlify bot commented Jul 13, 2023

Deploy Preview for docs-rometools failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 44fbd1b
🔍 Latest deploy log https://app.netlify.com/sites/docs-rometools/deploys/64b01a740ba4c70008095d46

@github-actions github-actions bot added A-Linter Area: linter A-Project Area: project configuration and loading labels Jul 13, 2023
@Conaclos
Copy link
Contributor Author

Conaclos commented Jul 13, 2023

The implementation should certainly use the control flow analyzer. For the mean time, it is a useful fix because some Rome rules require placing the statements of some switch clauses inside a block.

@Conaclos Conaclos requested a review from ematipico July 13, 2023 15:42
@Conaclos Conaclos merged commit 3c251f7 into rome:main Jul 14, 2023
13 of 17 checks passed
@Conaclos Conaclos removed the request for review from ematipico July 14, 2023 10:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter A-Project Area: project configuration and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant