Skip to content

Commit 7dc6196

Browse files
authored
chore: migrate biome to rslint (#167)
1 parent e4ef75e commit 7dc6196

9 files changed

Lines changed: 100 additions & 166 deletions

File tree

biome.jsonc

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

client-src/modules/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { FilterTypes } from '@rspack/core';
22

3-
// biome-ignore lint/suspicious/noExplicitAny: expected any
43
export type EXPECTED_ANY = any;
54

65
export type FilterFunction = (item: string) => boolean;

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
"bump": "npx bumpp",
2727
"dev": "rslib -w",
2828
"format": "prettier --write .",
29-
"lint": "biome check .",
30-
"lint:write": "biome check . --write",
29+
"lint": "rslint",
30+
"lint:write": "rslint --fix",
3131
"prettier:ci": "prettier --check .",
3232
"test": "pnpm run test:install && pnpm run build && rstest",
3333
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome"
@@ -37,11 +37,11 @@
3737
},
3838
"nano-staged": {
3939
"*.{yaml,yml,json,md,json5}": [
40-
"npm rum format"
40+
"npm run format"
4141
],
4242
"*.{js,jsx,ts,tsx,mjs,cjs}": [
4343
"npm run format",
44-
"biome lint --write --no-errors-on-unmatched"
44+
"rslint --fix"
4545
]
4646
},
4747
"dependencies": {
@@ -56,9 +56,9 @@
5656
"ws": "^8.19.0"
5757
},
5858
"devDependencies": {
59-
"@biomejs/biome": "^1.9.4",
6059
"@hono/node-server": "^1.19.11",
6160
"@rslib/core": "^0.20.0",
61+
"@rslint/core": "^0.3.2",
6262
"@rspack/core": "2.0.0-beta.7",
6363
"@rspack/plugin-react-refresh": "1.6.1",
6464
"@rstest/core": "^0.9.2",

pnpm-lock.yaml

Lines changed: 69 additions & 95 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rslint.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { defineConfig, ts } from '@rslint/core';
2+
3+
export default defineConfig([
4+
ts.configs.recommended,
5+
{
6+
rules: {
7+
'@typescript-eslint/no-unused-vars': 'off',
8+
'@typescript-eslint/no-explicit-any': 'off',
9+
},
10+
},
11+
]);

rstest.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { version } from '@rspack/core/package.json';
21
import { defineConfig } from '@rstest/core';
32

4-
console.log(`Running tests for rspack @${version} \n`);
5-
63
export default defineConfig({
74
globals: true,
85
include: ['tests/*.test.ts', 'tests/e2e/*.test.js'],

src/server.ts

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ class Server<
869869

870870
try {
871871
stats = fs.lstatSync(fs.realpathSync(item)).isFile();
872-
} catch (error) {
872+
} catch {
873873
// Ignore error
874874
}
875875

@@ -1203,33 +1203,12 @@ class Server<
12031203
#getClientTransport() {
12041204
let clientImplementation: string | undefined;
12051205
let clientImplementationFound = true;
1206-
1207-
const isKnownWebSocketServerImplementation =
1208-
this.options.webSocketServer &&
1209-
typeof (this.options.webSocketServer as WebSocketServerConfiguration)
1210-
.type === 'string' &&
1211-
// @ts-expect-error
1212-
this.options.webSocketServer.type === 'ws';
1213-
1214-
let clientTransport: string | undefined;
1215-
1216-
if (this.options.client) {
1217-
if (
1218-
typeof (this.options.client as DevServerClient).webSocketTransport !==
1219-
'undefined'
1220-
) {
1221-
clientTransport = (this.options.client as DevServerClient)
1222-
.webSocketTransport;
1223-
} else if (isKnownWebSocketServerImplementation) {
1224-
clientTransport = (
1225-
this.options.webSocketServer as WebSocketServerConfiguration
1226-
).type as string;
1227-
} else {
1228-
clientTransport = 'ws';
1229-
}
1230-
} else {
1231-
clientTransport = 'ws';
1232-
}
1206+
let clientTransport =
1207+
typeof this.options.client === 'object' &&
1208+
this.options.client !== null &&
1209+
typeof this.options.client.webSocketTransport !== 'undefined'
1210+
? this.options.client.webSocketTransport
1211+
: 'ws';
12331212

12341213
switch (typeof clientTransport) {
12351214
case 'string':
@@ -1257,11 +1236,7 @@ class Server<
12571236

12581237
if (!clientImplementationFound) {
12591238
throw new Error(
1260-
`${
1261-
!isKnownWebSocketServerImplementation
1262-
? 'When you use custom web socket implementation you must explicitly specify client.webSocketTransport. '
1263-
: ''
1264-
}client.webSocketTransport must be a string denoting a default implementation (e.g. 'ws') or a full path to a JS file via require.resolve(...) which exports a class `,
1239+
`client.webSocketTransport must be a string denoting a default implementation (e.g. 'ws') or a full path to a JS file via require.resolve(...) which exports a class `,
12651240
);
12661241
}
12671242

src/types.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export type {
4444
StatsOptions,
4545
} from '@rspack/core';
4646

47-
// biome-ignore lint/suspicious/noExplicitAny: expected any
4847
export type EXPECTED_ANY = any;
4948

5049
type BasicServer = import('node:net').Server | import('node:tls').Server;
@@ -136,18 +135,13 @@ export type Middleware =
136135

137136
export type OverlayMessageOptions = boolean | ((error: Error) => void);
138137

139-
// TypeScript overloads for connect-like use
140-
function useFn(fn: NextHandleFunction): BasicApplication;
141-
function useFn(fn: HandleFunction): BasicApplication;
142-
function useFn(route: string, fn: NextHandleFunction): BasicApplication;
143-
function useFn(route: string, fn: HandleFunction): BasicApplication;
144-
function useFn(
145-
routeOrFn: string | NextHandleFunction | HandleFunction,
146-
fn?: NextHandleFunction | HandleFunction,
147-
): BasicApplication {
148-
return {} as BasicApplication;
149-
}
138+
type UseFn = {
139+
(fn: NextHandleFunction): BasicApplication;
140+
(fn: HandleFunction): BasicApplication;
141+
(route: string, fn: NextHandleFunction): BasicApplication;
142+
(route: string, fn: HandleFunction): BasicApplication;
143+
};
150144

151145
export type BasicApplication = {
152-
use: typeof useFn;
146+
use: UseFn;
153147
};

tests/normalizeOptions.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ async function getAdditionEntries(
133133
const entries = compiler.__internal__builtinPlugins
134134
.filter((p) => p.name === 'EntryPlugin')
135135
.map((p) => p.options)
136-
// biome-ignore lint/suspicious/noExplicitAny: _
137136
.reduce<Record<string, any>>((acc: any, cur: any) => {
138137
const name = cur.options.name;
139138
const request = cur.entry;

0 commit comments

Comments
 (0)