{"record":{"id":"ccb008377ee6c663","repo":"oxc-project/oxc","slug":"invalid-fix-kind-s-valid-fix-kinds-are-fix-su","errorCode":null,"errorMessage":"invalid fix kind: {s}. Valid fix kinds are fix, suggestion, or dangerous.","messagePattern":"invalid fix kind: (.+?)\\. Valid fix kinds are fix, suggestion, or dangerous\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_macros/src/declare_oxc_lint.rs","lineNumber":466,"sourceCode":"        })\n        .unique()\n        .map(parse_fix_kind)\n        .reduce(|acc, kind| quote! { #acc.union(#kind) })\n        .expect(\"No fix kinds were found during parsing, but at least one is required.\");\n\n    if is_conditional {\n        quote! { RuleFixMeta::Conditional(#fix_kinds) }\n    } else {\n        quote! { RuleFixMeta::Fixable(#fix_kinds) }\n    }\n}\n\nfn parse_fix_kind(s: &str) -> proc_macro2::TokenStream {\n    match s {\n        \"fix\" | \"fixes\" => quote! { FixKind::Fix },\n        \"suggestion\" | \"suggestions\" => quote! { FixKind::Suggestion },\n        \"dangerous\" => quote! { FixKind::Dangerous },\n        _ => panic!(\"invalid fix kind: {s}. Valid fix kinds are fix, suggestion, or dangerous.\"),\n    }\n}\n","sourceCodeStart":448,"sourceCodeEnd":469,"githubUrl":"https://github.com/oxc-project/oxc/blob/a3d33dda7cb69da23db4fcaa2c0c05de61e760a1/crates/oxc_macros/src/declare_oxc_lint.rs#L448-L469","documentation":"Diagnostic from oxlint's vue/valid-define-emits rule (crates/oxc_linter/src/rules/vue/valid_define_emits.rs), `<script setup>` blocks only. It reports a `defineEmits` call that supplies both a literal type parameter and a runtime argument. The two declarations compete: the type parameter is the source of truth for inference while the argument overrides runtime options, degrading types and confusing readers.","triggerScenarios":"`defineEmits<(e: 'notify') => void>({ submit: null })` in a `<script setup lang=\"ts\">` block — type_arguments present AND at least one argument passed. The help text says to remove the argument for better type inference.","commonSituations":"Incrementally typing JS components to TS and leaving the old object argument behind; copy-paste combining both declaration styles; codemods adding type parameters without removing arguments.","solutions":["Delete the runtime argument: `defineEmits<(e: 'notify') => void>()`.","Or drop the type parameter and keep one fully typed runtime object with validator functions.","Keep exactly one declaration style per component."],"exampleFix":"// before\nconst emit = defineEmits<(e: 'notify') => void>({ submit: null });\n\n// after\nconst emit = defineEmits<(e: 'notify') => void>();","handlingStrategy":"validation","validationCode":"// reject defineEmits calls carrying both a type parameter and an argument\nconst re = /defineEmits\\s*(<[^>]*>)?\\s*\\(([^)]*)\\)/g;\nfor (const m of setupSource.matchAll(re)) {\n  if (m[1] && m[2].trim()) {\n    throw new Error('defineEmits: remove the argument when a type parameter is given');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one declaration style per component: type-only or runtime object, never both.","When adding a type parameter during TS migration, delete the old runtime argument in the same commit.","Review defineEmits diffs — single-line macro changes are easy to verify."],"tags":["vue","oxlint","lint","script-setup","defineemits","compiler-macro","typescript"],"backgroundTag":"vue-define-emits-misuse","analyzedSha":"a3d33dda7cb69da23db4fcaa2c0c05de61e760a1","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}