Skip to content

Commit

Permalink
feat(linter): add react/jsx-curly-brace-presence (#3949)
Browse files Browse the repository at this point in the history
Note that this PR does not implement a fixer, but one is available.
  • Loading branch information
DonIsaac authored Jul 31, 2024
1 parent eaf834f commit 85e8418
Show file tree
Hide file tree
Showing 4 changed files with 1,367 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/oxc_ast/src/ast/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,11 @@ pub enum JSXChild<'a> {
/// `<Foo>{...spread}</Foo>`
Spread(Box<'a, JSXSpreadChild<'a>>),
}
impl<'a> JSXChild<'a> {
pub const fn is_expression_container(&self) -> bool {
matches!(self, Self::ExpressionContainer(_))
}
}

/// JSX Spread Child.
///
Expand Down
2 changes: 2 additions & 0 deletions crates/oxc_linter/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ mod jest {
mod react {
pub mod button_has_type;
pub mod checked_requires_onchange_or_readonly;
pub mod jsx_curly_brace_presence;
pub mod jsx_key;
pub mod jsx_no_comment_textnodes;
pub mod jsx_no_duplicate_props;
Expand Down Expand Up @@ -716,6 +717,7 @@ oxc_macros::declare_all_lint_rules! {
react::button_has_type,
react::checked_requires_onchange_or_readonly,
react::jsx_no_target_blank,
react::jsx_curly_brace_presence,
react::jsx_key,
react::jsx_no_comment_textnodes,
react::jsx_no_duplicate_props,
Expand Down
Loading

0 comments on commit 85e8418

Please sign in to comment.