From 5175c6d8c0d5135cbfee3724755aa8ec11779445 Mon Sep 17 00:00:00 2001 From: camc314 <18101008+camc314@users.noreply.github.com> Date: Sun, 3 Aug 2025 22:49:27 +0000 Subject: [PATCH] fix(linter/jest/no-large-snapshots): update Default implementation for `NoLargeSnapshotsConfig` (#12786) --- crates/oxc_linter/src/rules/jest/no_large_snapshots.rs | 8 +++++++- crates/oxc_linter/tests/rule_configuration_test.rs | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs b/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs index 2198fe24449bf..5397d97f1b51c 100644 --- a/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs +++ b/crates/oxc_linter/src/rules/jest/no_large_snapshots.rs @@ -35,13 +35,19 @@ fn too_long_snapshot(line_limit: usize, line_count: usize, span: Span) -> OxcDia #[derive(Debug, Default, Clone)] pub struct NoLargeSnapshots(Box); -#[derive(Debug, Default, Clone)] +#[derive(Debug, Clone)] pub struct NoLargeSnapshotsConfig { pub max_size: usize, pub inline_max_size: usize, pub allowed_snapshots: FxHashMap>, } +impl Default for NoLargeSnapshotsConfig { + fn default() -> Self { + Self { max_size: 50, inline_max_size: 50, allowed_snapshots: FxHashMap::default() } + } +} + impl Deref for NoLargeSnapshots { type Target = NoLargeSnapshotsConfig; diff --git a/crates/oxc_linter/tests/rule_configuration_test.rs b/crates/oxc_linter/tests/rule_configuration_test.rs index 3824b63b01cc6..a77db06764267 100644 --- a/crates/oxc_linter/tests/rule_configuration_test.rs +++ b/crates/oxc_linter/tests/rule_configuration_test.rs @@ -25,7 +25,6 @@ fn test_rule_default_matches_from_configuration_null() { // 1. The Default implementation returns the same values as from_configuration(null), or // 2. The from_configuration method is updated to return Default::default() when given null let exceptions = [ - "jest/no-large-snapshots", "jest/prefer-lowercase-title", "react/jsx-filename-extension", "typescript/no-this-alias",