{"record":{"id":"8037142c01868c4c","repo":"oxc-project/oxc","slug":"use-runtime-declaration-instead-of-type-based-decl-803714","errorCode":null,"errorMessage":"Use runtime declaration instead of type-based declaration","messagePattern":"Use runtime declaration instead of type-based declaration","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"info","filePath":"crates/oxc_linter/src/rules/vue/define_props_declaration.rs","lineNumber":16,"sourceCode":"use oxc_ast::AstKind;\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\nuse schemars::JsonSchema;\nuse serde::{Deserialize, Serialize};\n\nuse crate::{\n    AstNode,\n    context::{ContextHost, LintContext},\n    frameworks::FrameworkOptions,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn use_runtime_declaration_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Use runtime declaration instead of type-based declaration\")\n        .with_label(span)\n}\n\nfn use_type_based_declaration_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Use type-based declaration instead of runtime declaration\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone, JsonSchema, Serialize, Deserialize)]\n#[serde(rename_all = \"kebab-case\")]\nenum DeclarationStyle {\n    /// Enforce type-based declaration.\n    #[default]\n    TypeBased,\n    /// Enforce runtime declaration.\n    Runtime,\n}\n","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/define_props_declaration.rs#L1-L34","documentation":"Diagnostic from oxlint's vue/define-props-declaration rule (style category, since oxlint 1.15.0). It fires inside <script setup lang=\"ts\"> when props are declared with the type-based form defineProps<{...}>() while the rule is configured to enforce the runtime form. The rule only enforces a single consistent declaration style; the code is not incorrect otherwise.","triggerScenarios":"Config sets \"vue/define-props-declaration\": [\"error\", \"runtime\"] (the enum is DeclarationStyle::Runtime, serde kebab-case \"runtime\") and the file contains a call like `const props = defineProps<{ kind: string }>()` in a TypeScript script-setup block.","commonSituations":"A team standardizes on runtime declarations so the SFC works without TS tooling, or a config is copied from another repo where the option was flipped; mixed-style codebases then fail lint/CI when this rule runs.","solutions":["Convert the call to runtime form: defineProps({ kind: { type: String, required: true } })","If the team actually prefers generics, change the rule option to \"type-based\" (the default) in .oxlintrc.json","Disable the rule for the file with an oxlint-disable comment or scope the lint globs"],"exampleFix":"// before (option \"runtime\")\nconst props = defineProps<{ kind: string }>()\n// after\nconst props = defineProps({\n  kind: { type: String, required: true },\n})","handlingStrategy":"validation","validationCode":"# count type-based usages before flipping the style to \"runtime\"\ngrep -rn \"defineProps<\" --include='*.vue' src | wc -l","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide the defineProps style once in .oxlintrc.json and encode it with this rule instead of relying on review","Run oxlint with the vue plugin in a pre-commit hook so style drift is caught before CI"],"tags":["vue","oxlint","lint","script-setup","defineprops","style"],"backgroundTag":"vue-props-declaration-style","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}