Skip to content

Commit dd1fdd4

Browse files
baevmcamc314
andauthored
feat(linter): add react/forbid-dom-props rule (#14365)
This PR adds `react/forbid-dom-props` rule, issue #1022 --------- Co-authored-by: Cameron Clark <[email protected]>
1 parent 831974f commit dd1fdd4

File tree

4 files changed

+493
-0
lines changed

4 files changed

+493
-0
lines changed

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,12 @@ impl RuleRunner for crate::rules::react::exhaustive_deps::ExhaustiveDeps {
21592159
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
21602160
}
21612161

2162+
impl RuleRunner for crate::rules::react::forbid_dom_props::ForbidDomProps {
2163+
const NODE_TYPES: Option<&AstTypesBitset> =
2164+
Some(&AstTypesBitset::from_types(&[AstType::JSXOpeningElement]));
2165+
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
2166+
}
2167+
21622168
impl RuleRunner for crate::rules::react::forbid_elements::ForbidElements {
21632169
const NODE_TYPES: Option<&AstTypesBitset> =
21642170
Some(&AstTypesBitset::from_types(&[AstType::CallExpression, AstType::JSXOpeningElement]));

crates/oxc_linter/src/rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ pub(crate) mod react {
341341
pub mod button_has_type;
342342
pub mod checked_requires_onchange_or_readonly;
343343
pub mod exhaustive_deps;
344+
pub mod forbid_dom_props;
344345
pub mod forbid_elements;
345346
pub mod forward_ref_uses_ref;
346347
pub mod iframe_missing_sandbox;
@@ -1013,6 +1014,7 @@ oxc_macros::declare_all_lint_rules! {
10131014
react::button_has_type,
10141015
react::checked_requires_onchange_or_readonly,
10151016
react::exhaustive_deps,
1017+
react::forbid_dom_props,
10161018
react::forbid_elements,
10171019
react::forward_ref_uses_ref,
10181020
react::iframe_missing_sandbox,

0 commit comments

Comments
 (0)