Skip to content

Commit f148dec

Browse files
committed
feat: replace rome with biome
1 parent 44221cf commit f148dec

File tree

14 files changed

+66
-53
lines changed

14 files changed

+66
-53
lines changed

benchmark/bench-cmp-branch.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
const { spawn } = require("node:child_process");
42

53
const cliSelect = require("cli-select");
@@ -56,7 +54,7 @@ function parseBenchmarksStdout(text) {
5654
results.push({
5755
name: match[1],
5856
alignedName: match[1] + match[2],
59-
result: parseInt(match[3].split(",").join("")),
57+
result: Number.parseInt(match[3].split(",").join("")),
6058
});
6159
}
6260
}
@@ -90,7 +88,7 @@ function compareResults(featureBranch, mainBranch) {
9088
}
9189
}
9290

93-
(async function () {
91+
(async () => {
9492
const branches = await git.branch();
9593
const currentBranch = branches.branches[branches.current];
9694

benchmark/bench-thread.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
const { workerData: benchmark, parentPort } = require("node:worker_threads");
42

53
const Benchmark = require("benchmark");

benchmark/bench.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
const path = require("node:path");
42
const { Worker } = require("node:worker_threads");
53

@@ -69,7 +67,7 @@ const benchmarks = [
6967
{
7068
type: "stringify",
7169
name: "{ id: Infinity }",
72-
input: { id: Infinity },
70+
input: { id: Number.POSITIVE_INFINITY },
7371
},
7472
{
7573
type: "stringify",

benchmark/parse.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import native from "node:querystring";
2+
import awsQueryStringParser from "@aws-sdk/querystring-parser";
13
import benchmark from "cronometro";
24
import qs from "qs";
3-
import fastQueryString from "../lib/index.js";
4-
import native from "node:querystring";
55
import queryString from "query-string";
66
import querystringify from "querystringify";
7-
import awsQueryStringParser from "@aws-sdk/querystring-parser";
87
import querystringparser from "querystringparser";
8+
import fastQueryString from "../lib/index.js";
99

1010
const input = "frappucino=muffin&goat=scone&pond=moose&foo=bar&foo=baz";
1111

benchmark/stringify.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import native from "node:querystring";
2+
import awsQueryStringBuilder from "@aws-sdk/querystring-builder";
13
import benchmark from "cronometro";
4+
import httpQuerystringStringify from "http-querystring-stringify";
25
import qs from "qs";
3-
import fastQueryString from "../lib/index.js";
4-
import native from "node:querystring";
56
import queryString from "query-string";
67
import querystringify from "querystringify";
7-
import httpQuerystringStringify from "http-querystring-stringify";
8-
import awsQueryStringBuilder from "@aws-sdk/querystring-builder";
9-
import querystringparser from "querystringparser";
108
import querystringifyQs from "querystringify-ts";
9+
import querystringparser from "querystringparser";
10+
import fastQueryString from "../lib/index.js";
1111

1212
const value = {
1313
frappucino: "muffin",

biome.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3+
"formatter": {
4+
"enabled": true,
5+
"indentStyle": "space",
6+
"indentWidth": 2
7+
},
8+
"linter": {
9+
"enabled": true,
10+
"rules": {
11+
"complexity": {
12+
"all": false
13+
},
14+
"style": {
15+
"all": false
16+
},
17+
"suspicious": {
18+
"noRedundantUseStrict": "off"
19+
}
20+
}
21+
},
22+
"organizeImports": {
23+
"enabled": true
24+
}
25+
}

lib/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
type FastQueryString = {
2+
// biome-ignore lint/suspicious/noExplicitAny: This is deliberate.
23
stringify(value: Record<string, any>): string;
4+
// biome-ignore lint/suspicious/noExplicitAny: This is deliberate.
35
parse(value: string): Record<string, any>;
46
};
57

68
declare namespace fastQueryString {
9+
// biome-ignore lint/suspicious/noExplicitAny: This is deliberate.
710
export function stringify(value: Record<string, any>): string;
11+
// biome-ignore lint/suspicious/noExplicitAny: This is deliberate.
812
export function parse(value: string): Record<string, any>;
913

1014
const fqs: FastQueryString;

lib/internals/querystring.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const hexTable = Array.from(
1212
// digits
1313
// alpha (uppercase)
1414
// alpha (lowercase)
15-
// rome-ignore format: the array should not be formatted
15+
// biome-ignore format: the array should not be formatted
1616
const noEscape = new Int8Array([
1717
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
1818
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31

lib/parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function parse(input) {
1919
return result;
2020
}
2121

22-
let inputLength = input.length;
22+
const inputLength = input.length;
2323
let key = "";
2424
let value = "";
2525
let startingIndex = -1;

package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"type": "commonjs",
77
"types": "./lib/index.d.ts",
88
"scripts": {
9-
"format": "rome format . --write",
10-
"format:ci": "rome ci .",
9+
"format": "biome check . --write",
10+
"format:ci": "rome check .",
1111
"test": "vitest",
1212
"test:environment:edge": "vitest --environment=edge-runtime",
1313
"test:environment:browser": "vitest --environment=jsdom",
@@ -20,16 +20,13 @@
2020
"benchmark:stringify": "node benchmark/stringify.mjs",
2121
"benchmark:import": "node benchmark/import.mjs"
2222
},
23-
"keywords": [
24-
"querystring",
25-
"qs",
26-
"parser"
27-
],
23+
"keywords": ["querystring", "qs", "parser"],
2824
"author": "Yagiz Nizipli <yagiz@nizipli.com>",
2925
"license": "MIT",
3026
"devDependencies": {
3127
"@aws-sdk/querystring-builder": "^3.357.0",
3228
"@aws-sdk/querystring-parser": "^3.357.0",
29+
"@biomejs/biome": "1.8.3",
3330
"@edge-runtime/vm": "^3.0.3",
3431
"@types/node": "^20.4.1",
3532
"@vitest/coverage-v8": "^0.34.1",
@@ -43,7 +40,6 @@
4340
"querystringify": "^2.2.0",
4441
"querystringify-ts": "^0.1.5",
4542
"querystringparser": "^0.1.1",
46-
"rome": "12.1.3",
4743
"simple-git": "^3.19.1",
4844
"vitest": "^0.34.1"
4945
},

0 commit comments

Comments
 (0)