Skip to content

Commit 66a705b

Browse files
[autofix.ci] apply automated fixes
1 parent 6abae9e commit 66a705b

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

napi/oxlint2/src/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { lint } from "./bindings.js";
1+
import { lint } from './bindings.js';
22

33
class PluginRegistry {
44
registeredPlugins = new Set();
@@ -45,10 +45,10 @@ class Linter {
4545
* @param {string} pluginName The name of the plugin we're loading
4646
*/
4747
loadPlugin = async (pluginName) => {
48-
console.log("registering plugin", pluginName);
48+
console.log('registering plugin', pluginName);
4949
if (this.pluginRegistry.isPluginRegistered(pluginName)) {
5050
return JSON.stringify({
51-
Failure: "This plugin has already been registered",
51+
Failure: 'This plugin has already been registered',
5252
});
5353
}
5454

@@ -58,10 +58,9 @@ class Linter {
5858
console.log(ret);
5959
return JSON.stringify({ Success: ret });
6060
} catch (error) {
61-
const errorMessage =
62-
"message" in error && typeof error.message === "string"
63-
? error.message
64-
: "An unknown error occurred";
61+
const errorMessage = 'message' in error && typeof error.message === 'string'
62+
? error.message
63+
: 'An unknown error occurred';
6564
return JSON.stringify({ Failure: errorMessage });
6665
}
6766
};
@@ -71,7 +70,7 @@ class Linter {
7170
* @param {number[]} ruleIds an array of ruleIds to run on the file
7271
*/
7372
lint = async (filePath, ruleIds) => {
74-
console.log(`Linting path ${filePath} with rules ${ruleIds.join(",")}`);
73+
console.log(`Linting path ${filePath} with rules ${ruleIds.join(',')}`);
7574

7675
const rules = Array.from({ length: ruleIds });
7776
for (const rule of rules) {

napi/oxlint2/test/e2e.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
import path from "node:path";
1+
import path from 'node:path';
22

3-
import { describe, expect, it } from "vitest";
3+
import { describe, expect, it } from 'vitest';
44

5-
import { execa } from "execa";
5+
import { execa } from 'execa';
66

77
const PACKAGE_ROOT_PATH = path.dirname(import.meta.dirname);
8-
const ENTRY_POINT_PATH = path.join(PACKAGE_ROOT_PATH, "src/index.js");
8+
const ENTRY_POINT_PATH = path.join(PACKAGE_ROOT_PATH, 'src/index.js');
99

1010
async function runOxlint(cwd: string, args: string[] = []) {
11-
return await execa("node", [ENTRY_POINT_PATH, ...args], {
11+
return await execa('node', [ENTRY_POINT_PATH, ...args], {
1212
cwd: path.join(PACKAGE_ROOT_PATH, cwd),
1313
reject: false,
1414
});
1515
}
1616

1717
function normalizeOutput(output: string): string {
1818
return output
19-
.replace(/Finished in \d+(\.\d+)?(s|ms|us|ns)/, "Finished in Xms")
20-
.replace(/using \d+ threads./, "using X threads.");
19+
.replace(/Finished in \d+(\.\d+)?(s|ms|us|ns)/, 'Finished in Xms')
20+
.replace(/using \d+ threads./, 'using X threads.');
2121
}
2222

23-
describe("cli options for bundling", () => {
24-
it("should lint a directory without errors", async () => {
23+
describe('cli options for bundling', () => {
24+
it('should lint a directory without errors', async () => {
2525
const { stdout, exitCode } = await runOxlint(
26-
"test/fixtures/built_in_no_errors"
26+
'test/fixtures/built_in_no_errors',
2727
);
2828

2929
expect(exitCode).toBe(0);
3030
expect(normalizeOutput(stdout)).toMatchSnapshot();
3131
});
3232

33-
it("should lint a directory with errors", async () => {
33+
it('should lint a directory with errors', async () => {
3434
const { stdout, exitCode } = await runOxlint(
35-
"test/fixtures/built_in_errors"
35+
'test/fixtures/built_in_errors',
3636
);
3737

3838
expect(exitCode).toBe(1);
3939
expect(normalizeOutput(stdout)).toMatchSnapshot();
4040
});
4141

42-
it.only("should load a custom plugin", async () => {
42+
it.only('should load a custom plugin', async () => {
4343
const { stdout, stderr, exitCode } = await runOxlint(
44-
"test/fixtures/basic_custom_plugin"
44+
'test/fixtures/basic_custom_plugin',
4545
);
46-
console.log("stdout", stdout, "stderr", stderr);
46+
console.log('stdout', stdout, 'stderr', stderr);
4747

4848
expect(exitCode).toBe(0);
4949
expect(normalizeOutput(stdout)).toMatchSnapshot();
5050
});
5151

52-
it("should report an error if a custom plugin cannot be loaded", async () => {
52+
it('should report an error if a custom plugin cannot be loaded', async () => {
5353
const { stdout, exitCode } = await runOxlint(
54-
"test/fixtures/missing_custom_plugin"
54+
'test/fixtures/missing_custom_plugin',
5555
);
5656

5757
expect(exitCode).toBe(1);

tasks/benchmark/benches/linter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn bench_linter(criterion: &mut Criterion) {
3131
let linter = Linter::new(
3232
LintOptions::default(),
3333
ConfigStore::new(lint_config, FxHashMap::default()),
34-
None
34+
None,
3535
)
3636
.with_fix(FixKind::All);
3737
group.bench_function(id, |b| {

0 commit comments

Comments
 (0)