Skip to content

Commit 200d17b

Browse files
re-tarocamc314
andauthored
feat(linter): add unicorn/prefer-keyboard-event-key rule (#16611)
This PR adds unicorn/prefer-keyboard-event-key rule, issue #684 [rule doc](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v62.0.0/docs/rules/prefer-keyboard-event-key.md) [rule source](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v62.0.0/rules/prefer-keyboard-event-key.js) --------- Co-authored-by: Cameron Clark <[email protected]>
1 parent 0be98b9 commit 200d17b

File tree

4 files changed

+1649
-0
lines changed

4 files changed

+1649
-0
lines changed

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3597,6 +3597,14 @@ impl RuleRunner for crate::rules::unicorn::prefer_includes::PreferIncludes {
35973597
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
35983598
}
35993599

3600+
impl RuleRunner for crate::rules::unicorn::prefer_keyboard_event_key::PreferKeyboardEventKey {
3601+
const NODE_TYPES: Option<&AstTypesBitset> = Some(&AstTypesBitset::from_types(&[
3602+
AstType::BindingProperty,
3603+
AstType::StaticMemberExpression,
3604+
]));
3605+
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;
3606+
}
3607+
36003608
impl RuleRunner for crate::rules::unicorn::prefer_logical_operator_over_ternary::PreferLogicalOperatorOverTernary {
36013609
const NODE_TYPES: Option<&AstTypesBitset> = Some(&AstTypesBitset::from_types(&[AstType::ConditionalExpression]));
36023610
const RUN_FUNCTIONS: RuleRunFunctionsImplemented = RuleRunFunctionsImplemented::Run;

crates/oxc_linter/src/rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ pub(crate) mod unicorn {
480480
pub mod prefer_event_target;
481481
pub mod prefer_global_this;
482482
pub mod prefer_includes;
483+
pub mod prefer_keyboard_event_key;
483484
pub mod prefer_logical_operator_over_ternary;
484485
pub mod prefer_math_min_max;
485486
pub mod prefer_math_trunc;
@@ -1227,6 +1228,7 @@ oxc_macros::declare_all_lint_rules! {
12271228
unicorn::prefer_top_level_await,
12281229
unicorn::prefer_at,
12291230
unicorn::prefer_global_this,
1231+
unicorn::prefer_keyboard_event_key,
12301232
unicorn::prefer_object_from_entries,
12311233
unicorn::prefer_array_find,
12321234
unicorn::prefer_array_index_of,

0 commit comments

Comments
 (0)