-
-
Notifications
You must be signed in to change notification settings - Fork 508
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linter): unicorn/switch-cases-braces support options (#8704)
close #8492
- Loading branch information
Showing
2 changed files
with
102 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 22 additions & 22 deletions
44
crates/oxc_linter/src/snapshots/unicorn_switch_case_braces.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,79 @@ | ||
--- | ||
source: crates/oxc_linter/src/tester.rs | ||
--- | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Missing braces in case clause. | ||
╭─[switch_case_braces.tsx:1:18] | ||
1 │ switch(s){case'':/]/} | ||
· ─── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Add Braces for case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Unexpected braces in empty case clause. | ||
╭─[switch_case_braces.tsx:1:29] | ||
1 │ switch(something) { case 1: {} case 2: {console.log('something'); break;}} | ||
· ── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Remove braces in empty case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Missing braces in case clause. | ||
╭─[switch_case_braces.tsx:1:37] | ||
1 │ switch(something) { case 1: case 2: console.log('something'); break;} | ||
· ──────────────────────────────── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Add Braces for case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Unexpected braces in empty case clause. | ||
╭─[switch_case_braces.tsx:1:23] | ||
1 │ switch(foo) { case 1: {} case 2: {} default: { doSomething(); } } | ||
· ── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Remove braces in empty case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Unexpected braces in empty case clause. | ||
╭─[switch_case_braces.tsx:1:34] | ||
1 │ switch(foo) { case 1: {} case 2: {} default: { doSomething(); } } | ||
· ── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Remove braces in empty case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Unexpected braces in empty case clause. | ||
╭─[switch_case_braces.tsx:1:23] | ||
1 │ switch(foo) { case 1: { /* fallthrough */ } default: {}/* fallthrough */ case 3: { doSomething(); break; } } | ||
· ───────────────────── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Remove braces in empty case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Unexpected braces in empty case clause. | ||
╭─[switch_case_braces.tsx:1:54] | ||
1 │ switch(foo) { case 1: { /* fallthrough */ } default: {}/* fallthrough */ case 3: { doSomething(); break; } } | ||
· ── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Remove braces in empty case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Missing braces in case clause. | ||
╭─[switch_case_braces.tsx:1:24] | ||
1 │ switch(foo) { default: doSomething(); } | ||
· ────────────── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Add Braces for case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Missing braces in case clause. | ||
╭─[switch_case_braces.tsx:1:23] | ||
1 │ switch(foo) { case 1: { doSomething(); } break; /* <-- This should be between braces */ } | ||
· ───────────────────────── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Add Braces for case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Missing braces in case clause. | ||
╭─[switch_case_braces.tsx:1:24] | ||
1 │ switch(foo) { default: label: {} } | ||
· ───────── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Add Braces for case clause. | ||
|
||
⚠ eslint-plugin-unicorn(switch-case-braces): Empty switch case shouldn't have braces and not-empty case should have braces around it. | ||
⚠ eslint-plugin-unicorn(switch-case-braces): Missing braces in case clause. | ||
╭─[switch_case_braces.tsx:1:82] | ||
1 │ switch(something) { case 1: case 2: { console.log('something'); break; } case 3: console.log('something else'); } | ||
· ────────────────────────────── | ||
╰──── | ||
help: There is less visual clutter for empty cases and proper scope for non-empty cases. | ||
help: Add Braces for case clause. |