Skip to content

Commit 33f6645

Browse files
committed
refactor(linter): mark napi::lint as async
1 parent dd6b1ee commit 33f6645

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ oxc_tasks_transform_checker = { path = "tasks/transform_checker" }
140140
oxlint = { path = "apps/oxlint" }
141141

142142
# Relaxed version so the user can decide which version to use.
143-
napi = "3.0.0-beta"
143+
napi = { version = "3.0.0-beta", features = ["tokio_rt"] }
144144
napi-build = "2.2.1"
145145
napi-derive = "3.0.0-beta"
146146

napi/oxlint2/src/bindings.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/* auto-generated by NAPI-RS */
22
/* eslint-disable */
3-
export declare function lint(): boolean
3+
export declare function lint(): Promise<boolean>

napi/oxlint2/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ class Linter {
66
}
77
}
88

9-
function main() {
9+
async function main() {
1010
const linter = new Linter();
1111

12-
const result = linter.run();
12+
const result = await linter.run();
1313

1414
if (!result) {
1515
process.exit(1);

napi/oxlint2/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ use napi_derive::napi;
44

55
use oxlint::lint as oxlint_lint;
66

7+
#[expect(clippy::allow_attributes)]
8+
#[allow(clippy::trailing_empty_array, clippy::unused_async)] // https://github.com/napi-rs/napi-rs/issues/2758
79
#[napi]
8-
pub fn lint() -> bool {
10+
pub async fn lint() -> bool {
911
oxlint_lint().report() == ExitCode::SUCCESS
1012
}

0 commit comments

Comments
 (0)