Skip to content

Commit 0db34ab

Browse files
committed
fix(linter/react/jsx-filename-case): update Default implementation for JsxFilenameExtensionConfig (#12788)
1 parent ff84eff commit 0db34ab

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

crates/oxc_linter/src/rules/react/jsx_filename_extension.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,23 @@ impl AllowType {
4141
#[derive(Debug, Default, Clone)]
4242
pub struct JsxFilenameExtension(Box<JsxFilenameExtensionConfig>);
4343

44-
#[derive(Debug, Default, Clone)]
44+
#[derive(Debug, Clone)]
4545
pub struct JsxFilenameExtensionConfig {
4646
allow: AllowType,
4747
extensions: Vec<CompactStr>,
4848
ignore_files_without_code: bool,
4949
}
5050

51+
impl Default for JsxFilenameExtensionConfig {
52+
fn default() -> Self {
53+
Self {
54+
allow: AllowType::Always,
55+
extensions: vec![CompactStr::from("jsx")],
56+
ignore_files_without_code: false,
57+
}
58+
}
59+
}
60+
5161
impl std::ops::Deref for JsxFilenameExtension {
5262
type Target = JsxFilenameExtensionConfig;
5363

crates/oxc_linter/tests/rule_configuration_test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ fn test_rule_default_matches_from_configuration_null() {
2525
// 1. The Default implementation returns the same values as from_configuration(null), or
2626
// 2. The from_configuration method is updated to return Default::default() when given null
2727
let exceptions = [
28-
"react/jsx-filename-extension",
2928
"typescript/no-this-alias",
3029
"unicorn/prefer-object-from-entries",
3130
"unicorn/prefer-structured-clone",

0 commit comments

Comments
 (0)