Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions biome.jsonc

This file was deleted.

1 change: 0 additions & 1 deletion client-src/modules/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { FilterTypes } from '@rspack/core';

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

export type FilterFunction = (item: string) => boolean;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"bump": "npx bumpp",
"dev": "rslib -w",
"format": "prettier --write .",
"lint": "biome check .",
"lint:write": "biome check . --write",
"lint": "rslint",
"lint:write": "rslint --fix",
"prettier:ci": "prettier --check .",
"test": "pnpm run test:install && pnpm run build && rstest",
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome"
Expand All @@ -37,11 +37,11 @@
},
"nano-staged": {
"*.{yaml,yml,json,md,json5}": [
"npm rum format"
"npm run format"
],
"*.{js,jsx,ts,tsx,mjs,cjs}": [
"npm run format",
"biome lint --write --no-errors-on-unmatched"
"rslint --fix"
]
},
"dependencies": {
Expand All @@ -56,9 +56,9 @@
"ws": "^8.19.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@hono/node-server": "^1.19.11",
"@rslib/core": "^0.20.0",
"@rslint/core": "^0.3.2",
"@rspack/core": "2.0.0-beta.7",
"@rspack/plugin-react-refresh": "1.6.1",
"@rstest/core": "^0.9.2",
Expand Down
164 changes: 69 additions & 95 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions rslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
ts.configs.recommended,
{
rules: {
'@typescript-eslint/no-unused-vars': 'off',
Comment thread
chenjiahan marked this conversation as resolved.
'@typescript-eslint/no-explicit-any': 'off',
},
},
]);
3 changes: 0 additions & 3 deletions rstest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { version } from '@rspack/core/package.json';
import { defineConfig } from '@rstest/core';

console.log(`Running tests for rspack @${version} \n`);

export default defineConfig({
globals: true,
include: ['tests/*.test.ts', 'tests/e2e/*.test.js'],
Expand Down
18 changes: 8 additions & 10 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ class Server<

try {
stats = fs.lstatSync(fs.realpathSync(item)).isFile();
} catch (error) {
} catch {
// Ignore error
}

Expand Down Expand Up @@ -1203,13 +1203,13 @@ class Server<
#getClientTransport() {
let clientImplementation: string | undefined;
let clientImplementationFound = true;

const isKnownWebSocketServerImplementation =
const webSocketServerType =
this.options.webSocketServer &&
typeof (this.options.webSocketServer as WebSocketServerConfiguration)
.type === 'string' &&
// @ts-expect-error
this.options.webSocketServer.type === 'ws';
typeof this.options.webSocketServer === 'object'
? this.options.webSocketServer.type
: undefined;

const isKnownWebSocketServerImplementation = webSocketServerType === 'ws';

let clientTransport: string | undefined;

Expand All @@ -1221,9 +1221,7 @@ class Server<
clientTransport = (this.options.client as DevServerClient)
.webSocketTransport;
} else if (isKnownWebSocketServerImplementation) {
clientTransport = (
this.options.webSocketServer as WebSocketServerConfiguration
).type as string;
clientTransport = webSocketServerType;
Comment thread
chenjiahan marked this conversation as resolved.
Outdated
} else {
clientTransport = 'ws';
}
Expand Down
20 changes: 7 additions & 13 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export type {
StatsOptions,
} from '@rspack/core';

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

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

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

// TypeScript overloads for connect-like use
function useFn(fn: NextHandleFunction): BasicApplication;
function useFn(fn: HandleFunction): BasicApplication;
function useFn(route: string, fn: NextHandleFunction): BasicApplication;
function useFn(route: string, fn: HandleFunction): BasicApplication;
function useFn(
routeOrFn: string | NextHandleFunction | HandleFunction,
fn?: NextHandleFunction | HandleFunction,
): BasicApplication {
return {} as BasicApplication;
}
type UseFn = {
(fn: NextHandleFunction): BasicApplication;
(fn: HandleFunction): BasicApplication;
(route: string, fn: NextHandleFunction): BasicApplication;
(route: string, fn: HandleFunction): BasicApplication;
};

export type BasicApplication = {
use: typeof useFn;
use: UseFn;
};
1 change: 0 additions & 1 deletion tests/normalizeOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ async function getAdditionEntries(
const entries = compiler.__internal__builtinPlugins
.filter((p) => p.name === 'EntryPlugin')
.map((p) => p.options)
// biome-ignore lint/suspicious/noExplicitAny: _
.reduce<Record<string, any>>((acc: any, cur: any) => {
const name = cur.options.name;
const request = cur.entry;
Expand Down
Loading