{"record":{"id":"cc707ff2cec371a0","repo":"oxc-project/oxc","slug":"options-are-not-defined","errorCode":null,"errorMessage":"Options are not defined.","messagePattern":"Options are not defined\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/vue/valid_define_options.rs","lineNumber":25,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{\n    AstNode, ast_util::variable_declaration_kind, context::LintContext,\n    frameworks::FrameworkOptions, rule::Rule,\n};\n\nfn referencing_locally_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`defineOptions` is referencing locally declared variables.\")\n        .with_label(span)\n}\n\nfn multiple_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`defineOptions` has been called multiple times.\").with_label(span)\n}\n\nfn not_defined_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Options are not defined.\").with_label(span)\n}\n\nfn disallow_prop_diagnostic(span: Span, prop_name: &str, instead_macro: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\n        \"`defineOptions()` cannot be used to declare `{prop_name}`. Use `{instead_macro}()` instead.\"\n    ))\n    .with_label(span)\n}\n\nfn type_args_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`defineOptions()` cannot accept type arguments.\").with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct ValidDefineOptions;\n\ndeclare_oxc_lint!(\n    /// ### What it does","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/valid_define_options.rs#L7-L43","documentation":"Diagnostic from the oxlint rule `vue/valid-define-options`. In `check_call`, if the first argument slot of `defineOptions(...)` has no expression (`call.arguments.first().and_then(|arg| arg.as_expression())` is None), the call is reported as having no options. `defineOptions` exists solely to declare compile-time options; calling it with no object literal is meaningless and the Vue compiler rejects it.","triggerScenarios":"A bare `defineOptions()` call in a .vue file (VueSetup framework option). Also triggered when the first argument is a spread or non-expression argument kind that `as_expression()` returns None for. The diagnostic points at the whole call span.","commonSituations":"Adding `defineOptions()` as a placeholder before filling in options; refactoring away the argument but leaving the call; typos like `defineOptions(;)`.","solutions":["Pass an object literal with the options you need: `defineOptions({ name: 'Foo' })`.","If you do not need any options, delete the `defineOptions()` call entirely.","If you intended to declare props/emits, use `defineProps`/`defineEmits` instead of an empty `defineOptions`."],"exampleFix":"// before\n<script setup>\ndefineOptions()\n</script>\n\n// after\n<script setup>\ndefineOptions({ name: 'Foo' })\n</script>","handlingStrategy":"validation","validationCode":"if (/\\bdefineOptions\\s*\\(\\s*\\)/.test(src)) {\n  throw new Error('defineOptions() called without an options object');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never scaffold an empty defineOptions() placeholder — add options when you add the call or omit it.","Run oxlint in CI so the vue/valid-define-options rule catches empty calls."],"tags":["vue","script-setup","compiler-macro","defineoptions","lint","missing-argument"],"backgroundTag":"vue-script-setup-macro-misuse","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"}