oxc-project/oxc · warning · OxcDiagnostic
`Vue.config.keyCodes` are deprecated.
Error message
`Vue.config.keyCodes` are deprecated.
What it means
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.
Source
Thrown at crates/oxc_linter/src/rules/vue/no_deprecated_vue_config_keycodes.rs:9
use oxc_ast::{AstKind, ast::Expression};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;
use crate::{AstNode, context::LintContext, rule::Rule};
fn no_deprecated_vue_config_keycodes_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("`Vue.config.keyCodes` are deprecated.").with_label(span)
}
#[derive(Debug, Default, Clone)]
pub struct NoDeprecatedVueConfigKeycodes;
declare_oxc_lint!(
/// ### What it does
///
/// Disallow using deprecated `Vue.config.keyCodes` (in Vue.js 3.0.0+).
///
/// ### Why is this bad?
///
/// `Vue.config.keyCodes` was removed in Vue 3. Code that relies on it will
/// silently stop working when upgrading.
///
/// ### Examples
///
/// Examples of **incorrect** code for this rule:View on GitHub (pinned to e1e7af627c)
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
Example fix
// before
Vue.config.keyCodes = { f1: 112 }
// template: @keydown.f1="onF1"
// after
// template: @keydown.f1 stays valid via KeyboardEvent.key
onKeydown(e) {
if (e.key === 'F1') this.onF1()
} Defensive patterns
Strategy: validation
Validate before calling
# find dead keyCodes config grep -rn "config.keyCodes" --include='*.vue' --include='*.js' --include='*.ts' src
Prevention
- 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
When it happens
Trigger: An assignment expression whose target member chain is Vue.config.keyCodes (AstKind::AssignmentExpression with an Expression member target naming config.keyCodes on Vue).
Common situations: 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.
Related errors
- `$delete` and `$set` are deprecated.
- The Events api `{}` is deprecated.
- Object declaration on `data` property is deprecated.
- The `{deprecated}` lifecycle hook is deprecated. Use `{repla
- `model` definition is deprecated.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/1557488a84118040.
Report an issue: GitHub.