Skip to content

Commit

Permalink
fixup: fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
geeksilva97 committed Jan 12, 2025
1 parent 01ee4c0 commit 69a3bf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
17 changes: 8 additions & 9 deletions src/node_sqlite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class BackupJob : public ThreadPoolWork {
Local<Object> e = Local<Object>();

if (backup_status_ != SQLITE_OK) {
CreateSQLiteError(isolate, pDest_).ToLocal(&e);
e = CreateSQLiteError(isolate, pDest_).ToLocalChecked();

Cleanup();

Expand All @@ -195,7 +195,7 @@ class BackupJob : public ThreadPoolWork {
pDest_, dest_db_.c_str(), source_->Connection(), source_db_.c_str());

if (pBackup_ == nullptr) {
CreateSQLiteError(isolate, pDest_).ToLocal(&e);
e = CreateSQLiteError(isolate, pDest_).ToLocalChecked();

sqlite3_close(pDest_);

Expand Down Expand Up @@ -227,9 +227,8 @@ class BackupJob : public ThreadPoolWork {

if (!(backup_status_ == SQLITE_OK || backup_status_ == SQLITE_DONE ||
backup_status_ == SQLITE_BUSY || backup_status_ == SQLITE_LOCKED)) {
Local<Object> e = Local<Object>();

CreateSQLiteError(env()->isolate(), backup_status_).ToLocal(&e);
Local<Object> e =
CreateSQLiteError(env()->isolate(), backup_status_).ToLocalChecked();

Cleanup();

Expand Down Expand Up @@ -275,8 +274,8 @@ class BackupJob : public ThreadPoolWork {
env()->isolate(), "Backup completed", NewStringType::kNormal)
.ToLocalChecked();

Local<Object> e = Local<Object>();
CreateSQLiteError(env()->isolate(), pDest_).ToLocal(&e);
Local<Object> e =
CreateSQLiteError(env()->isolate(), pDest_).ToLocalChecked();

Cleanup();

Expand Down Expand Up @@ -826,8 +825,8 @@ void DatabaseSync::Backup(const FunctionCallbackInfo<Value>& args) {
}

Local<Promise::Resolver> resolver = Promise::Resolver::New(env->context())
.ToLocalChecked()
.As<Promise::Resolver>();
.ToLocalChecked()
.As<Promise::Resolver>();

args.GetReturnValue().Set(resolver->GetPromise());

Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-sqlite-backup.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import common from '../common/index.js';
import * as common from '../common/index.mjs';
import tmpdir from '../common/tmpdir.js';
import { join } from 'path';
import { DatabaseSync } from 'node:sqlite';
Expand Down Expand Up @@ -58,7 +58,8 @@ test('database backup', async (t) => {
const backup = new DatabaseSync(destDb);
const rows = backup.prepare('SELECT * FROM data').all();

// The source database has two pages - using the default page size -, so the progress function should be called once (the last call is not made since
// The source database has two pages - using the default page size -,
// so the progress function should be called once (the last call is not made since
// the promise resolves)
t.assert.strictEqual(progressFn.mock.calls.length, 1);
t.assert.deepStrictEqual(rows, [
Expand All @@ -80,4 +81,3 @@ test('database backup fails when dest file is not writable', (t) => {
message: 'attempt to write a readonly database'
}));
});

0 comments on commit 69a3bf3

Please sign in to comment.