Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
49 changes: 31 additions & 18 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"organizeImports": {
"enabled": true,
"include": [
"./**/*.js",
"./**/*.jsx",
"./**/*.ts",
"./**/*.tsx",
"./**/*.mjs",
"./**/*.cjs"
]
"$schema": "https://biomejs.dev/schemas/2.0.0/schema.json",
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"vcs": {
"enabled": true,
Expand All @@ -18,12 +14,13 @@
"useIgnoreFile": true
},
"files": {
"ignore": [
"*.vue",
"*.svelte",
"template-lit-*/src/my-element.*",
"tsconfig.json",
"tsconfig.*.json"
"includes": [
"**",
"!**/*.vue",
"!**/*.svelte",
"!**/template-lit-*/src/my-element.*",
"!**/tsconfig.json",
"!**/tsconfig.*.json"
],
"ignoreUnknown": true
},
Expand All @@ -46,14 +43,30 @@
"options": {
"filenameCases": ["camelCase", "PascalCase", "export"]
}
}
},
"noParameterAssign": "error",
"useAsConstAssertion": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "error",
"useSelfClosingElements": "error",
"useSingleVarDeclarator": "error",
"noUnusedTemplateLiteral": "error",
"useNumberNamespace": "error",
"noInferrableTypes": "error",
"noUselessElse": "error"
},
"suspicious": {
"noExplicitAny": "off",
"noConfusingVoidType": "off"
},
"performance": {
"noDelete": "off"
},
"nursery": {
"useUniqueElementIds": "off"
},
"correctness": {
"useHookAtTopLevel": "off"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions e2e/cases/assets/emit-assets/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import small from '../../../../assets/icon.png?url';

const testJson = new URL('./assets/test.json', import.meta.url).href;

console.log(small);
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/cli/watch-files-array/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path';
import { type RsbuildPlugin, defineConfig } from '@rsbuild/core';
import { defineConfig, type RsbuildPlugin } from '@rsbuild/core';
import fse from 'fs-extra';
import content from './test-temp-config';

Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/cli/watch-files/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path';
import { type RsbuildPlugin, defineConfig } from '@rsbuild/core';
import { defineConfig, type RsbuildPlugin } from '@rsbuild/core';
import fse from 'fs-extra';
import content from './test-temp-config';

Expand Down
3 changes: 1 addition & 2 deletions e2e/cases/css/css-assets/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import path from 'node:path';
import { build } from '@e2e/helper';
import { readDirContents } from '@e2e/helper';
import { build, readDirContents } from '@e2e/helper';
import { expect, test } from '@playwright/test';

test('should build CSS assets correctly', async () => {
Expand Down
1 change: 1 addition & 0 deletions e2e/cases/html/template-with-script/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ test('should compile template with es template correctly', async () => {

const indexHtml =
files[Object.keys(files).find((file) => file.endsWith('index.html'))!];
// biome-ignore lint/suspicious/noTemplateCurlyInString: should ignore string
expect(indexHtml).toContain("const baseUrl = match ? `${match[0]}/` : '/'");
});
1 change: 0 additions & 1 deletion e2e/cases/module-federation-v2/host/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';

Expand Down
1 change: 0 additions & 1 deletion e2e/cases/module-federation-v2/remote/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';

Expand Down
1 change: 0 additions & 1 deletion e2e/cases/module-federation/host/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';

Expand Down
1 change: 0 additions & 1 deletion e2e/cases/module-federation/remote/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';

Expand Down
4 changes: 0 additions & 4 deletions e2e/cases/module/glob-import/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useState } from 'react';

const context = import.meta.webpackContext('./components', {
regExp: /\.jsx$/,
recursive: false,
Expand All @@ -8,8 +6,6 @@ const context = import.meta.webpackContext('./components', {
const fileNames = context.keys();

const App = () => {
const [count, setCount] = useState(0);

const components = fileNames.map((fileName) => {
const module = context(fileName);
const Component = module.default;
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/node-polyfill-tip/with-protocol/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test('should print tips if resolve Node.js builtin module failed', async () => {

try {
await build({ cwd: __dirname });
} catch (err) {}
} catch {}

restore();
expect(
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/node-polyfill-tip/without-protocol/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test('should print tips if resolve Node.js builtin module failed', async () => {

try {
await build({ cwd: __dirname });
} catch (err) {}
} catch {}

restore();
expect(
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/plugin-api/plugin-after-build-hook/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs';
import path from 'node:path';
import { rspackOnlyTest } from '@e2e/helper';
import { expect } from '@playwright/test';
import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core';
import { createRsbuild, type RsbuildPlugin } from '@rsbuild/core';
import fse, { remove } from 'fs-extra';

const distFile = path.join(__dirname, 'node_modules/hooksTempFile');
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/plugin-api/plugin-expose/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { rspackOnlyTest } from '@e2e/helper';
import { expect } from '@playwright/test';
import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core';
import { createRsbuild, type RsbuildPlugin } from '@rsbuild/core';

type ParentAPI = {
initial: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getRandomPort, gotoPage, rspackOnlyTest } from '@e2e/helper';
import { expect } from '@playwright/test';
import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core';
import { createRsbuild, type RsbuildPlugin } from '@rsbuild/core';

const createPlugin = () => {
const names: string[] = [];
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/plugin-api/plugin-hooks-watch/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'node:fs';
import { join } from 'node:path';
import { expectFile, rspackOnlyTest } from '@e2e/helper';
import { expect } from '@playwright/test';
import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core';
import { createRsbuild, type RsbuildPlugin } from '@rsbuild/core';
import fse, { remove } from 'fs-extra';

const createPlugin = () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/plugin-api/plugin-hooks/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getRandomPort, gotoPage, rspackOnlyTest } from '@e2e/helper';
import { expect } from '@playwright/test';
import { type RsbuildPlugin, createRsbuild } from '@rsbuild/core';
import { createRsbuild, type RsbuildPlugin } from '@rsbuild/core';

const createPlugin = () => {
const names: string[] = [];
Expand Down
2 changes: 0 additions & 2 deletions e2e/cases/plugin-react/enable-profiler/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

const App = () => <div id="test">Hello Rsbuild!</div>;

export default App;
1 change: 1 addition & 0 deletions e2e/cases/plugin-react/legacy-jsx/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// biome-ignore lint/correctness/noUnusedImports: required in legacy jsx
import React from 'react';

const App = () => <div id="test">Hello Rsbuild!</div>;
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/plugin-solid/ref/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSignal } from 'solid-js';

const App = () => {
const [el, setEl] = createSignal();
const [_el, setEl] = createSignal();
return (
<div id="test" ref={setEl}>
abc
Expand Down
1 change: 0 additions & 1 deletion e2e/cases/plugin-svgr/exclude-importer/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import Bar from './Bar';
import Foo from './Foo';
Expand Down
1 change: 0 additions & 1 deletion e2e/cases/plugin-svgr/exclude/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import Bar from './Bar';
import Foo from './Foo';
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/rsdoctor/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { proxyConsole, rspackOnlyTest } from '@e2e/helper';
import { expect } from '@playwright/test';
import { type Rspack, createRsbuild } from '@rsbuild/core';
import { createRsbuild, type Rspack } from '@rsbuild/core';
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
import { matchPlugin } from '@scripts/test-helper';

Expand Down
2 changes: 2 additions & 0 deletions e2e/cases/server/overlay-type-errors/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This is a type error
let num = 1;
num = '2';

console.log(num);
4 changes: 2 additions & 2 deletions e2e/cases/server/ssr-type-module/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
type RequestHandler,
type SetupMiddlewaresServer,
defineConfig,
logger,
type RequestHandler,
type SetupMiddlewaresServer,
} from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';

Expand Down
4 changes: 2 additions & 2 deletions e2e/cases/server/ssr/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
type RequestHandler,
type SetupMiddlewaresServer,
defineConfig,
logger,
type RequestHandler,
type SetupMiddlewaresServer,
} from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';

Expand Down
4 changes: 2 additions & 2 deletions e2e/cases/sri/algotithm/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ rspackOnlyTest(
files[Object.keys(files).find((file) => file.endsWith('index.html'))!];

expect(html).toMatch(
/<script defer src="\/static\/js\/index\.\w{8}\.js" integrity="sha512-[A-Za-z0-9+\/=]+"/,
/<script defer src="\/static\/js\/index\.\w{8}\.js" integrity="sha512-[A-Za-z0-9+/=]+"/,
);

expect(html).toMatch(
/link href="\/static\/css\/index\.\w{8}\.css" rel="stylesheet" integrity="sha512-[A-Za-z0-9+\/=]+"/,
/link href="\/static\/css\/index\.\w{8}\.css" rel="stylesheet" integrity="sha512-[A-Za-z0-9+/=]+"/,
);

const testEl = page.locator('#root');
Expand Down
4 changes: 2 additions & 2 deletions e2e/cases/sri/basic/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ rspackOnlyTest(
files[Object.keys(files).find((file) => file.endsWith('index.html'))!];

expect(html).toMatch(
/<script defer src="\/static\/js\/index\.\w{8}\.js" integrity="sha384-[A-Za-z0-9+\/=]+"/,
/<script defer src="\/static\/js\/index\.\w{8}\.js" integrity="sha384-[A-Za-z0-9+/=]+"/,
);

expect(html).toMatch(
/link href="\/static\/css\/index\.\w{8}\.css" rel="stylesheet" integrity="sha384-[A-Za-z0-9+\/=]+"/,
/link href="\/static\/css\/index\.\w{8}\.css" rel="stylesheet" integrity="sha384-[A-Za-z0-9+/=]+"/,
);

const testEl = page.locator('#root');
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/sri/enable-dev/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ rspackOnlyTest(
await page.evaluate(
'document.querySelector("script")?.getAttribute("integrity")',
),
).toMatch(/sha384-[A-Za-z0-9+\/=]+/);
).toMatch(/sha384-[A-Za-z0-9+/=]+/);

await rsbuild.close();

Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/sri/preload/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rspackOnlyTest(
files[Object.keys(files).find((file) => file.endsWith('index.html'))!];

expect(html).toMatch(
/<link href="\/static\/js\/async\/foo\.\w{8}\.js" rel="preload" as="script" integrity="sha384-[A-Za-z0-9+\/=]+"/,
/<link href="\/static\/js\/async\/foo\.\w{8}\.js" rel="preload" as="script" integrity="sha384-[A-Za-z0-9+/=]+"/,
);

const testEl = page.locator('#root');
Expand Down
2 changes: 1 addition & 1 deletion e2e/scripts/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function isPortAvailable(port: number) {
resolve(false);
});
});
} catch (err) {
} catch {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/lit/src/my-element.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// biome-ignore lint/style/useFilenamingConvention: lint components use kebab-case
import { LitElement, css, html } from 'lit';
import { css, html, LitElement } from 'lit';

export class MyElement extends LitElement {
static styles = css`
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
]
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@biomejs/biome": "^2.0.0",
"@rsbuild/config": "workspace:*",
"@rstest/core": "0.0.1",
"@scripts/test-helper": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/plugin-webpack-swc/src/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { TransformConfig } from './types.js';

export {
minify,
minifySync,
minifyCss,
minifyCssSync,
minifySync,
} from '@modern-js/swc-plugins';

export class Compiler extends RawCompiler {
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/plugin-webpack-swc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './binding.js';
export { default as SwcLoader } from './loader.js';
export { pluginSwc } from './plugin.js';
export * from './binding.js';
export * from './types.js';
2 changes: 1 addition & 1 deletion packages/compat/plugin-webpack-swc/src/minimizer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
logger,
type NormalizedEnvironmentConfig,
type Rspack,
logger,
} from '@rsbuild/core';
import type { webpack } from '@rsbuild/webpack';
import deepmerge from 'deepmerge';
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/plugin-webpack-swc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type {
import type _ from 'lodash';

export type {
JsMinifyOptions,
Output,
TransformConfig,
JsMinifyOptions,
} from '@modern-js/swc-plugins';

export type OuterExtensions = Omit<Extensions, 'ssrLoaderId' | 'configRoutes'>;
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/plugin-webpack-swc/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const getCoreJsVersion = (corejsPkgPath: string) => {
const { version } = JSON.parse(rawJson);
const [major, minor] = version.split('.');
return `${major}.${minor}`;
} catch (err) {
} catch {
return '3';
}
};
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/webpack/src/build.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { logger } from '@rsbuild/core';
import type { Build, BuildOptions, Rspack } from '@rsbuild/core';
import { logger } from '@rsbuild/core';
import type { Configuration as WebpackConfig } from 'webpack';
import WebpackMultiStats from 'webpack/lib/MultiStats.js';
import { createCompiler } from './createCompiler.js';
Expand Down
Loading
Loading