Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9ebdf0

Browse files
committed
fix(linter): Correct the default config options for the switch-exhaustiveness-check rule.
The original ESLint rule has `allowDefaultCaseForExhaustiveSwitch: true` by default.
1 parent1a58eea commitc9ebdf0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎crates/oxc_linter/src/rules/typescript/switch_exhaustiveness_check.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use oxc_macros::declare_oxc_lint;
22
use schemars::JsonSchema;
33
use serde::{Deserialize,Serialize};
44

5-
usecrate::rule::{DefaultRuleConfig,Rule};
5+
usecrate::{
6+
rule::{DefaultRuleConfig,Rule},
7+
utils::default_true,
8+
};
69

710
#[derive(Debug,Default,Clone)]
811
pubstructSwitchExhaustivenessCheck(Box<SwitchExhaustivenessCheckConfig>);
@@ -12,6 +15,7 @@ pub struct SwitchExhaustivenessCheck(Box<SwitchExhaustivenessCheckConfig>);
1215
pubstructSwitchExhaustivenessCheckConfig{
1316
/// Whether to allow default cases on switches that are not exhaustive.
1417
/// When false, requires exhaustive switch statements without default cases.
18+
#[serde(default ="default_true")]
1519
puballow_default_case_for_exhaustive_switch:bool,
1620
/// Whether to consider `default` cases exhaustive for union types.
1721
/// When true, a switch statement with a `default` case is considered exhaustive

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp