Skip to content

Commit 997fb3c

Browse files
dferber90AndyBitzvercel[bot]
authored
replace prettier and ESLint with biome (#889)
* replace eslint and prettier with biome * rm unused directives * Update packages/blob/jest/setup.js Co-authored-by: Andy <[email protected]> * Update test/next/package.json Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> * fix lint/check * ensure turbo can be used when checking * rm @vercel/style-guide --------- Co-authored-by: Andy <[email protected]> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
1 parent c90427a commit 997fb3c

File tree

105 files changed

+493
-4597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+493
-4597
lines changed

.eslintrc.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/quality.yml

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ on:
1313
branches: [main]
1414

1515
jobs:
16-
prettier:
17-
name: 'Prettier'
16+
biome:
17+
name: "Biome"
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Checkout
@@ -25,38 +25,17 @@ jobs:
2525

2626
- uses: actions/setup-node@v4
2727
with:
28-
node-version-file: '.node-version'
29-
cache: 'pnpm'
28+
node-version-file: ".node-version"
29+
cache: "pnpm"
3030

3131
- name: Install dependencies
3232
run: pnpm install
3333

34-
- name: Run Prettier check
35-
run: pnpm prettier-check
36-
37-
eslint:
38-
name: 'ESLint'
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v4
43-
44-
- name: Setup pnpm
45-
uses: pnpm/action-setup@v2
46-
47-
- uses: actions/setup-node@v4
48-
with:
49-
node-version-file: '.node-version'
50-
cache: 'pnpm'
51-
52-
- name: Install dependencies
53-
run: pnpm install
54-
55-
- name: Run ESLint
56-
run: pnpm run lint
34+
- name: Run Biome Check
35+
run: pnpm check
5736

5837
types:
59-
name: 'TypeScript'
38+
name: "TypeScript"
6039
runs-on: ubuntu-latest
6140
steps:
6241
- name: Checkout
@@ -67,8 +46,8 @@ jobs:
6746

6847
- uses: actions/setup-node@v4
6948
with:
70-
node-version-file: '.node-version'
71-
cache: 'pnpm'
49+
node-version-file: ".node-version"
50+
cache: "pnpm"
7251

7352
- name: Install dependencies
7453
run: pnpm install
@@ -77,7 +56,7 @@ jobs:
7756
run: pnpm run type-check
7857

7958
publint:
80-
name: 'publint'
59+
name: "publint"
8160
runs-on: ubuntu-latest
8261
steps:
8362
- name: Checkout
@@ -88,8 +67,8 @@ jobs:
8867

8968
- uses: actions/setup-node@v4
9069
with:
91-
node-version-file: '.node-version'
92-
cache: 'pnpm'
70+
node-version-file: ".node-version"
71+
cache: "pnpm"
9372

9473
- name: Install dependencies
9574
run: pnpm install

biome.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.7/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "space"
14+
},
15+
"linter": {
16+
"enabled": true,
17+
"rules": {
18+
"recommended": true,
19+
"correctness": {
20+
"noUnusedFunctionParameters": "off",
21+
"useUniqueElementIds": "off"
22+
},
23+
"complexity": {
24+
"noUselessSwitchCase": "off"
25+
},
26+
"suspicious": {
27+
"noExplicitAny": "off",
28+
"noArrayIndexKey": "off",
29+
"noUnknownAtRules": "off"
30+
},
31+
"a11y": {
32+
"noSvgWithoutTitle": "off",
33+
"useMediaCaption": "off"
34+
},
35+
"performance": {
36+
"noImgElement": "off"
37+
},
38+
"style": {
39+
"useNodejsImportProtocol": "off",
40+
"noNonNullAssertion": "off"
41+
}
42+
}
43+
},
44+
"javascript": {
45+
"formatter": {
46+
"quoteStyle": "single"
47+
}
48+
}
49+
}

package.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
"scripts": {
1212
"build": "turbo build",
1313
"integration-test": "turbo integration-test",
14-
"lint": "turbo lint -- --max-warnings=0",
14+
"check": "turbo check",
1515
"prepare": "husky",
16-
"prettier-check": "prettier --check .",
17-
"prettier-fix": "prettier --write .",
16+
"check:fix": "biome check --write .",
1817
"publint": "turbo publint",
1918
"release": "pnpm build && changeset publish",
2019
"run-integration": "pnpm -F vercel-storage-integration-test-suite dev",
@@ -23,20 +22,16 @@
2322
"version-packages": "changeset version && pnpm i --no-frozen-lockfile && git add ."
2423
},
2524
"lint-staged": {
26-
"*": [
27-
"prettier --ignore-unknown --write"
25+
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
26+
"biome check --write --no-errors-on-unmatched"
2827
]
2928
},
30-
"prettier": "@vercel/style-guide/prettier",
3129
"devDependencies": {
30+
"@biomejs/biome": "2.2.7",
3231
"@changesets/cli": "2.28.1",
33-
"@vercel/style-guide": "5.2.0",
34-
"eslint": "8.56.0",
35-
"eslint-config-custom": "workspace:*",
3632
"husky": "9.1.7",
3733
"jest": "29.7.0",
3834
"lint-staged": "15.4.3",
39-
"prettier": "3.5.2",
4035
"publint": "0.3.7",
4136
"ts-jest": "29.2.6",
4237
"turbo": "2.4.4",

packages/blob/jest/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// but they are available everywhere else.
33
// See https://stackoverflow.com/questions/68468203/why-am-i-getting-textencoder-is-not-defined-in-jest
44
const { TextEncoder, TextDecoder } = require('node:util');
5-
// eslint-disable-next-line import/order -- On purpose to make requiring undici work
5+
// On purpose to make requiring undici work
66
const { ReadableStream } = require('node:stream/web');
77

88
Object.assign(global, { TextDecoder, TextEncoder, ReadableStream });

packages/blob/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@
4242
"build": "tsup && pnpm run copy-shims",
4343
"copy-shims": "cp src/*-browser.js dist/",
4444
"dev": "pnpm run copy-shims && tsup --watch --clean=false",
45-
"lint": "eslint --max-warnings=0 .",
45+
"check": "biome check",
4646
"prepublishOnly": "pnpm run build",
47-
"prettier-check": "prettier --check .",
4847
"publint": "npx publint",
4948
"test": "pnpm run test:node && pnpm run test:edge && pnpm run test:browser",
5049
"test:browser": "jest --env jsdom .browser.test.ts --setupFilesAfterEnv ./jest/setup.js",
@@ -72,8 +71,6 @@
7271
"@types/async-retry": "1.4.9",
7372
"@types/jest": "29.5.14",
7473
"@types/node": "22.13.5",
75-
"eslint": "8.56.0",
76-
"eslint-config-custom": "workspace:*",
7774
"jest": "29.7.0",
7875
"jest-environment-jsdom": "29.7.0",
7976
"ts-jest": "29.2.6",

packages/blob/src/api.node.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import undici from 'undici';
22
import {
33
BlobAccessError,
4+
BlobContentTypeNotAllowedError,
45
BlobNotFoundError,
56
BlobServiceNotAvailable,
67
BlobStoreNotFoundError,
78
BlobStoreSuspendedError,
89
BlobUnknownError,
9-
BlobContentTypeNotAllowedError,
1010
requestApi,
1111
} from './api';
1212
import { BlobError } from './helpers';

packages/blob/src/api.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { Response } from 'undici';
21
import retry from 'async-retry';
3-
import isNetworkError from './is-network-error';
2+
import type { Response } from 'undici';
43
import { debug } from './debug';
4+
import { DOMException } from './dom-exception';
55
import type {
66
BlobCommandOptions,
77
BlobRequestInit,
@@ -13,8 +13,8 @@ import {
1313
getApiUrl,
1414
getTokenFromOptionsOrEnv,
1515
} from './helpers';
16+
import isNetworkError from './is-network-error';
1617
import { blobRequest } from './request';
17-
import { DOMException } from './dom-exception';
1818

1919
// maximum pathname length is:
2020
// 1024 (provider limit) - 26 chars (vercel internal suffixes) - 31 chars (blob `-randomId` suffix) = 967
@@ -209,18 +209,15 @@ async function getBlobError(
209209
error = new BlobAccessError();
210210
break;
211211
case 'content_type_not_allowed':
212-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- TS, be smarter
213212
error = new BlobContentTypeNotAllowedError(message!);
214213
break;
215214
case 'client_token_pathname_mismatch':
216-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- TS, be smarter
217215
error = new BlobPathnameMismatchError(message!);
218216
break;
219217
case 'client_token_expired':
220218
error = new BlobClientTokenExpiredError();
221219
break;
222220
case 'file_too_large':
223-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- TS, be smarter
224221
error = new BlobFileTooLargeError(message!);
225222
break;
226223
case 'not_found':

packages/blob/src/bytes.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@ type ByteUnitMap = {
1313
readonly [_K in ByteUnit]: number;
1414
};
1515

16-
// eslint-disable-next-line prefer-named-capture-group -- fine
1716
const parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
1817

1918
const map: ByteUnitMap = {
2019
b: 1,
21-
// eslint-disable-next-line no-bitwise -- fine
20+
2221
kb: 1 << 10,
23-
// eslint-disable-next-line no-bitwise -- fine
22+
2423
mb: 1 << 20,
25-
// eslint-disable-next-line no-bitwise -- fine
24+
2625
gb: 1 << 30,
27-
tb: Math.pow(1024, 4),
28-
pb: Math.pow(1024, 5),
26+
tb: 1024 ** 4,
27+
pb: 1024 ** 5,
2928
};
3029

3130
export function bytes(val: string | number): number | null {
32-
if (typeof val === 'number' && !isNaN(val)) {
31+
if (typeof val === 'number' && !Number.isNaN(val)) {
3332
return val;
3433
}
3534
if (typeof val !== 'string') {
@@ -53,7 +52,7 @@ export function bytes(val: string | number): number | null {
5352
}
5453
}
5554

56-
if (isNaN(floatValue)) {
55+
if (Number.isNaN(floatValue)) {
5756
return null;
5857
}
5958

packages/blob/src/client.browser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import undici from 'undici';
22
import {
33
completeMultipartUpload,
44
createMultipartUpload,
5-
uploadPart,
6-
upload,
75
createMultipartUploader,
86
put,
7+
upload,
8+
uploadPart,
99
} from './client';
1010

1111
describe('client', () => {

0 commit comments

Comments
 (0)