From 0db34ab087d8cc2a80861a82029fdd7aa3222bbb 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/react/jsx-filename-case): update Default implementation for `JsxFilenameExtensionConfig` (#12788) --- .../src/rules/react/jsx_filename_extension.rs | 12 +++++++++++- crates/oxc_linter/tests/rule_configuration_test.rs | 1 - 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs b/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs index 1b75fea329a3f..b9ab2e1965fad 100644 --- a/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs +++ b/crates/oxc_linter/src/rules/react/jsx_filename_extension.rs @@ -41,13 +41,23 @@ impl AllowType { #[derive(Debug, Default, Clone)] pub struct JsxFilenameExtension(Box); -#[derive(Debug, Default, Clone)] +#[derive(Debug, Clone)] pub struct JsxFilenameExtensionConfig { allow: AllowType, extensions: Vec, ignore_files_without_code: bool, } +impl Default for JsxFilenameExtensionConfig { + fn default() -> Self { + Self { + allow: AllowType::Always, + extensions: vec![CompactStr::from("jsx")], + ignore_files_without_code: false, + } + } +} + impl std::ops::Deref for JsxFilenameExtension { type Target = JsxFilenameExtensionConfig; diff --git a/crates/oxc_linter/tests/rule_configuration_test.rs b/crates/oxc_linter/tests/rule_configuration_test.rs index 047d7d705945c..e068399285a53 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 = [ - "react/jsx-filename-extension", "typescript/no-this-alias", "unicorn/prefer-object-from-entries", "unicorn/prefer-structured-clone",