Skip to content

Commit 15eb326

Browse files
feat(linter): add vue/no-required-prop-with-default rule (#13613)
related #11440 https://eslint.vuejs.org/rules/no-required-prop-with-default.html --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
1 parent e90bfe3 commit 15eb326

File tree

5 files changed

+1740
-0
lines changed

5 files changed

+1740
-0
lines changed

crates/oxc_linter/src/context/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use crate::{
1717
config::GlobalValue,
1818
disable_directives::DisableDirectives,
1919
fixer::{Fix, FixKind, Message, PossibleFixes, RuleFix, RuleFixer},
20+
frameworks::FrameworkOptions,
2021
};
2122

2223
mod host;
@@ -443,6 +444,12 @@ impl<'a> LintContext<'a> {
443444
self.parent.frameworks
444445
}
445446

447+
/// Returns the framework options for the current script block.
448+
/// For Vue files, this can be `FrameworkOptions::VueSetup` if we're in a `<script setup>` block.
449+
pub fn frameworks_options(&self) -> FrameworkOptions {
450+
self.parent.frameworks_options()
451+
}
452+
446453
pub fn other_file_hosts(&self) -> Vec<&ContextSubHost<'a>> {
447454
self.parent.other_file_hosts()
448455
}

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,6 +2690,10 @@ impl RuleRunner for crate::rules::vue::no_multiple_slot_args::NoMultipleSlotArgs
26902690
Some(&AstTypesBitset::from_types(&[AstType::CallExpression]));
26912691
}
26922692

2693+
impl RuleRunner for crate::rules::vue::no_required_prop_with_default::NoRequiredPropWithDefault {
2694+
const NODE_TYPES: Option<&AstTypesBitset> = None;
2695+
}
2696+
26932697
impl RuleRunner for crate::rules::vue::require_typed_ref::RequireTypedRef {
26942698
const NODE_TYPES: Option<&AstTypesBitset> =
26952699
Some(&AstTypesBitset::from_types(&[AstType::CallExpression]));

crates/oxc_linter/src/rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ pub(crate) mod vue {
631631
pub mod define_emits_declaration;
632632
pub mod define_props_declaration;
633633
pub mod no_multiple_slot_args;
634+
pub mod no_required_prop_with_default;
634635
pub mod require_typed_ref;
635636
pub mod valid_define_emits;
636637
pub mod valid_define_props;
@@ -1218,6 +1219,7 @@ oxc_macros::declare_all_lint_rules! {
12181219
vue::define_emits_declaration,
12191220
vue::define_props_declaration,
12201221
vue::no_multiple_slot_args,
1222+
vue::no_required_prop_with_default,
12211223
vue::require_typed_ref,
12221224
vue::valid_define_emits,
12231225
vue::valid_define_props,

0 commit comments

Comments
 (0)