Skip to content

Commit 1cd7520

Browse files
authored
feat(lint): add noSharedBranchCode (#12889)
1 parent 15039f7 commit 1cd7520

13 files changed

Lines changed: 1555 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Added the nursery rule [`noSharedBranchCode`](https://biomejs.dev/linter/rules/no-shared-branch-code/), which reports code that is repeated at the start or end of every branch of an `if` statement. That code runs no matter which branch is taken, so it can be moved before or after the `if` statement.
6+
7+
```js
8+
if (condition) {
9+
doSomething();
10+
cleanup();
11+
} else {
12+
doSomethingElse();
13+
cleanup();
14+
}
15+
```

β€Žcrates/biome_configuration/src/analyzer/linter/rules.rsβ€Ž

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žcrates/biome_configuration/src/generated/linter_options_check.rsβ€Ž

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žcrates/biome_diagnostics_categories/src/categories.rsβ€Ž

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)