{"record":{"id":"1557488a84118040","repo":"oxc-project/oxc","slug":"vue-config-keycodes-are-deprecated","errorCode":null,"errorMessage":"`Vue.config.keyCodes` are deprecated.","messagePattern":"`Vue\\.config\\.keyCodes` are deprecated\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/vue/no_deprecated_vue_config_keycodes.rs","lineNumber":9,"sourceCode":"use oxc_ast::{AstKind, ast::Expression};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn no_deprecated_vue_config_keycodes_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"`Vue.config.keyCodes` are deprecated.\").with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoDeprecatedVueConfigKeycodes;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Disallow using deprecated `Vue.config.keyCodes` (in Vue.js 3.0.0+).\n    ///\n    /// ### Why is this bad?\n    ///\n    /// `Vue.config.keyCodes` was removed in Vue 3. Code that relies on it will\n    /// silently stop working when upgrading.\n    ///\n    /// ### Examples\n    ///\n    /// Examples of **incorrect** code for this rule:","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/vue/no_deprecated_vue_config_keycodes.rs#L1-L27","documentation":"Diagnostic from oxlint's vue/no-deprecated-vue-config-keycodes rule (since oxlint 1.62.0). It fires on assignments to Vue.config.keyCodes, the Vue 2 global config that defined aliases for v-on key modifiers (e.g. keyCodes: { f1: 112 }). Vue 3 removed it entirely; the assignment is silently ignored and custom aliases stop matching, breaking keyboard handlers with no error.","triggerScenarios":"An assignment expression whose target member chain is Vue.config.keyCodes (AstKind::AssignmentExpression with an Expression member target naming config.keyCodes on Vue).","commonSituations":"App bootstrap files (main.js) ported from Vue 2 that register key aliases like enter: 13 or f1: 112; keyboard shortcuts quietly die after the upgrade because modifiers no longer resolve.","solutions":["Use the kebab-case key name directly in the template: @keydown.page-down=\"onPageDown\"","For named aliases, check event.key in the handler: if (e.key === 'F1') ...","Remove the Vue.config.keyCodes assignment entirely — it has no effect in Vue 3"],"exampleFix":"// before\nVue.config.keyCodes = { f1: 112 }\n// template: @keydown.f1=\"onF1\"\n// after\n// template: @keydown.f1 stays valid via KeyboardEvent.key\nonKeydown(e) {\n  if (e.key === 'F1') this.onF1()\n}","handlingStrategy":"validation","validationCode":"# find dead keyCodes config\ngrep -rn \"config.keyCodes\" --include='*.vue' --include='*.js' --include='*.ts' src","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In Vue 3, use kebab-case key names in template modifiers or switch on event.key in handlers","Search the codebase for Vue.config.* assignments during upgrades — several config keys were removed"],"tags":["vue","oxlint","lint","keycodes","vue3","migration","removed-api"],"backgroundTag":"vue-2-to-3-migration","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"}