Skip to content

Commit 0e8b91b

Browse files
committed
feat(linter/unicorn): implement prefer-top-level-await
1 parent 891fc47 commit 0e8b91b

File tree

4 files changed

+708
-0
lines changed

4 files changed

+708
-0
lines changed

crates/oxc_linter/src/generated/rule_runner_impls.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2800,6 +2800,11 @@ impl RuleRunner for crate::rules::unicorn::prefer_structured_clone::PreferStruct
28002800
Some(&AstTypesBitset::from_types(&[AstType::CallExpression]));
28012801
}
28022802

2803+
impl RuleRunner for crate::rules::unicorn::prefer_top_level_await::PreferTopLevelAwait {
2804+
const NODE_TYPES: Option<&AstTypesBitset> =
2805+
Some(&AstTypesBitset::from_types(&[AstType::CallExpression]));
2806+
}
2807+
28032808
impl RuleRunner for crate::rules::unicorn::prefer_type_error::PreferTypeError {
28042809
const NODE_TYPES: Option<&AstTypesBitset> =
28052810
Some(&AstTypesBitset::from_types(&[AstType::ThrowStatement]));

crates/oxc_linter/src/rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ pub(crate) mod unicorn {
487487
pub mod prefer_string_starts_ends_with;
488488
pub mod prefer_string_trim_start_end;
489489
pub mod prefer_structured_clone;
490+
pub mod prefer_top_level_await;
490491
pub mod prefer_type_error;
491492
pub mod require_array_join_separator;
492493
pub mod require_number_to_fixed_digits_argument;
@@ -1177,6 +1178,7 @@ oxc_macros::declare_all_lint_rules! {
11771178
unicorn::number_literal_case,
11781179
unicorn::numeric_separators_style,
11791180
unicorn::prefer_class_fields,
1181+
unicorn::prefer_top_level_await,
11801182
unicorn::prefer_at,
11811183
unicorn::prefer_global_this,
11821184
unicorn::prefer_object_from_entries,

0 commit comments

Comments
 (0)