diff --git a/packages/compat/uni-builder/src/webpack/webpackPlugins/ModuleScopePlugin.ts b/packages/compat/uni-builder/src/webpack/webpackPlugins/ModuleScopePlugin.ts index 239ab91116..6e7b6db9be 100644 --- a/packages/compat/uni-builder/src/webpack/webpackPlugins/ModuleScopePlugin.ts +++ b/packages/compat/uni-builder/src/webpack/webpackPlugins/ModuleScopePlugin.ts @@ -44,7 +44,7 @@ export class ModuleScopePlugin { this; resolver.hooks.file.tapAsync( 'ModuleScopePlugin', - (request: any, contextResolver: any, callback: any) => { + (request: any, _context: unknown, callback: any) => { const { issuer } = request.context; // Unknown issuer, probably webpack internals diff --git a/packages/compat/webpack/src/plugins/css.ts b/packages/compat/webpack/src/plugins/css.ts index c78e0c041e..412d2141e6 100644 --- a/packages/compat/webpack/src/plugins/css.ts +++ b/packages/compat/webpack/src/plugins/css.ts @@ -39,8 +39,6 @@ export async function applyBaseCSSRule({ // 1. Check user config const enableExtractCSS = isUseCssExtract(config, target); - const enableCssMinify = !enableExtractCSS && isProd; - const enableSourceMap = isUseCssSourceMap(config); const enableCSSModuleTS = Boolean(config.output.enableCssModuleTSDeclaration); @@ -122,7 +120,6 @@ export async function applyBaseCSSRule({ enableSourceMap, browserslist, config, - enableCssMinify, }); rule diff --git a/packages/compat/webpack/src/plugins/progress.ts b/packages/compat/webpack/src/plugins/progress.ts index 4bfc35da41..6761d03287 100644 --- a/packages/compat/webpack/src/plugins/progress.ts +++ b/packages/compat/webpack/src/plugins/progress.ts @@ -1,4 +1,4 @@ -import { TARGET_ID_MAP, isProd } from '@rsbuild/shared'; +import { TARGET_ID_MAP } from '@rsbuild/shared'; import type { RsbuildPlugin } from '../types'; export const pluginProgress = (): RsbuildPlugin => ({ diff --git a/packages/core/src/rspack-provider/plugins/css.ts b/packages/core/src/rspack-provider/plugins/css.ts index eb34efe92d..74370dceb4 100644 --- a/packages/core/src/rspack-provider/plugins/css.ts +++ b/packages/core/src/rspack-provider/plugins/css.ts @@ -38,7 +38,6 @@ export async function applyBaseCSSRule({ importLoaders?: number; }) { // 1. Check user config - const enableExtractCSS = isUseCssExtract(config, target); const enableSourceMap = isUseCssSourceMap(config); const enableCSSModuleTS = Boolean(config.output.enableCssModuleTSDeclaration); @@ -48,8 +47,6 @@ export async function applyBaseCSSRule({ target, ); - const enableCssMinify = !enableExtractCSS && isProd; - // when disableExtractCSS, use css-loader + style-loader if (!enableNativeCss(config)) { const localIdentName = getCssModuleLocalIdentName(config, isProd); @@ -130,7 +127,6 @@ export async function applyBaseCSSRule({ enableSourceMap, browserslist, config, - enableCssMinify, }); rule diff --git a/packages/doctor-core/src/inner-plugins/utils/plugin.ts b/packages/doctor-core/src/inner-plugins/utils/plugin.ts index 3266e7c2ac..1c5c71c72e 100644 --- a/packages/doctor-core/src/inner-plugins/utils/plugin.ts +++ b/packages/doctor-core/src/inner-plugins/utils/plugin.ts @@ -9,7 +9,7 @@ export function reportPluginData( tapName: string, start: number, type: SDK.PluginHookData['type'], - res: unknown, + _res: unknown, err?: Error, ) { const end = Date.now(); diff --git a/packages/doctor-sdk/src/sdk/sdk/core.ts b/packages/doctor-sdk/src/sdk/sdk/core.ts index 7756e5bd1a..fbbd902b45 100644 --- a/packages/doctor-sdk/src/sdk/sdk/core.ts +++ b/packages/doctor-sdk/src/sdk/sdk/core.ts @@ -113,7 +113,7 @@ export abstract class SDKCore /** Upload analysis data pieces */ protected async writePieces( storeData: Common.PlainObject, - options?: SDK.WriteStoreOptionsType, + _options?: SDK.WriteStoreOptionsType, ) { const { outputDir } = this; const manifest = path.resolve(outputDir, Constants.DoctorOutputManifest); diff --git a/packages/doctor-sdk/src/sdk/sdk/webpack.ts b/packages/doctor-sdk/src/sdk/sdk/webpack.ts index 507439489c..2ee9c5858c 100644 --- a/packages/doctor-sdk/src/sdk/sdk/webpack.ts +++ b/packages/doctor-sdk/src/sdk/sdk/webpack.ts @@ -425,7 +425,7 @@ export class DoctorWebpackSDK< } public getRuleContext( - options: SDK.RuntimeContextOptions, + _options: SDK.RuntimeContextOptions, ): SDK.RuntimeContext { this.createPackageGraph(); diff --git a/packages/doctor-sdk/src/sdk/server/index.ts b/packages/doctor-sdk/src/sdk/server/index.ts index 02df783c11..075a483465 100644 --- a/packages/doctor-sdk/src/sdk/server/index.ts +++ b/packages/doctor-sdk/src/sdk/server/index.ts @@ -3,7 +3,7 @@ import { Server } from '@rsbuild/doctor-utils/build'; import { Bundle } from '@rsbuild/doctor-utils/common'; import assert from 'assert'; import bodyParser from 'body-parser'; -import open from 'open'; +// import open from 'open'; import ip from 'ip'; import cors from 'cors'; import { PassThrough } from 'stream'; diff --git a/packages/doctor-utils/src/common/data/index.ts b/packages/doctor-utils/src/common/data/index.ts index 6aec6d9452..5a2b4a7c91 100644 --- a/packages/doctor-utils/src/common/data/index.ts +++ b/packages/doctor-utils/src/common/data/index.ts @@ -188,7 +188,6 @@ export class APIDataLoader { ]).then((res) => { const { moduleId } = body as SDK.ServerAPI.InferRequestBodyType; - const { chunks = [] } = res[0] || {}; const { modules = [], dependencies = [] } = res[1] || {}; return Graph.getModuleDetails(moduleId, modules, dependencies) as R; }); @@ -297,7 +296,7 @@ export class APIDataLoader { this.loader.loadData('configs'), ]).then( ([ - manifest, + _manifest, root = '', hash = '', errors = {}, diff --git a/packages/doctor-webpack-plugin/src/multiple.ts b/packages/doctor-webpack-plugin/src/multiple.ts index 805d1e5993..4aa1b3fd53 100644 --- a/packages/doctor-webpack-plugin/src/multiple.ts +++ b/packages/doctor-webpack-plugin/src/multiple.ts @@ -9,6 +9,7 @@ let globalController: DoctorSDKController | undefined; export class RsbuildDoctorWebpackMultiplePlugin< Rules extends Linter.ExtendRuleData[], > extends RsbuildDoctorWebpackPlugin { + // @ts-expect-error private controller: DoctorSDKController; constructor(options: DoctorWebpackMultiplePluginOptions = {}) { diff --git a/packages/doctor-webpack-plugin/src/plugins/resolver.ts b/packages/doctor-webpack-plugin/src/plugins/resolver.ts index 6e5a9ee2b4..847fb7b413 100644 --- a/packages/doctor-webpack-plugin/src/plugins/resolver.ts +++ b/packages/doctor-webpack-plugin/src/plugins/resolver.ts @@ -178,7 +178,7 @@ export class DoctorResolverPlugin implements ResolvePluginInstance { } }); - resolver.hooks.resolveStep.tap(this.tapOptions, (hook, request) => { + resolver.hooks.resolveStep.tap(this.tapOptions, (_, request) => { const { context } = request as unknown as ResolveRequestWithContext; if (context.issuer && !this.contextMap.has(context.issuer)) { this.contextMap.set(context.issuer, [Date.now(), process.hrtime()]); diff --git a/packages/plugin-babel/src/types.ts b/packages/plugin-babel/src/types.ts index b3798bc504..5560d66677 100644 --- a/packages/plugin-babel/src/types.ts +++ b/packages/plugin-babel/src/types.ts @@ -1,4 +1,4 @@ -import type { ChainedConfig, ChainedConfigWithUtils } from '@rsbuild/shared'; +import type { ChainedConfigWithUtils } from '@rsbuild/shared'; import type { PluginItem as BabelPlugin, PluginOptions as BabelPluginOptions, diff --git a/packages/shared/src/apply/resolve.ts b/packages/shared/src/apply/resolve.ts index de74468382..1ec612ff41 100644 --- a/packages/shared/src/apply/resolve.ts +++ b/packages/shared/src/apply/resolve.ts @@ -10,7 +10,7 @@ import { } from '../types'; export function applyResolvePlugin(api: SharedRsbuildPluginAPI) { - api.modifyBundlerChain((chain, { target, CHAIN_ID }) => { + api.modifyBundlerChain((chain, { CHAIN_ID }) => { const config = api.getNormalizedConfig(); const isTsProject = Boolean(api.context.tsconfigPath); applyExtensions({ diff --git a/packages/shared/src/config.ts b/packages/shared/src/config.ts index 0545cea179..8a0dd0af7c 100644 --- a/packages/shared/src/config.ts +++ b/packages/shared/src/config.ts @@ -16,7 +16,6 @@ import { DEFAULT_ASSET_PREFIX, } from './constants'; import type { - RsbuildTarget, BundlerChainRule, RsbuildConfig, InspectConfigOptions, diff --git a/packages/shared/src/css.ts b/packages/shared/src/css.ts index 4f6516638e..26e9279436 100644 --- a/packages/shared/src/css.ts +++ b/packages/shared/src/css.ts @@ -5,7 +5,6 @@ import deepmerge from '../compiled/deepmerge'; import { getSharedPkgCompiledPath as getCompiledPath } from './utils'; import { mergeChainedOptions } from './mergeChainedOptions'; import type { - CssModules, RsbuildTarget, CSSLoaderOptions, NormalizedConfig, @@ -70,12 +69,10 @@ export const getCssnanoDefaultOptions = (): CssNanoOptions => ({ }); export const getPostcssConfig = ({ - enableCssMinify, enableSourceMap, browserslist, config, }: { - enableCssMinify: boolean; enableSourceMap: boolean; browserslist: string[]; config: NormalizedConfig; diff --git a/packages/shared/src/types/config/source.ts b/packages/shared/src/types/config/source.ts index 5b7d685ac9..91e9bacadd 100644 --- a/packages/shared/src/types/config/source.ts +++ b/packages/shared/src/types/config/source.ts @@ -1,4 +1,4 @@ -import type { RsbuildEntry, RsbuildTarget } from '../rsbuild'; +import type { RsbuildEntry } from '../rsbuild'; import type { ChainedConfig } from '../utils'; export type Alias = Record; diff --git a/packages/shared/src/types/hooks.ts b/packages/shared/src/types/hooks.ts index d8b022cb48..59fe521554 100644 --- a/packages/shared/src/types/hooks.ts +++ b/packages/shared/src/types/hooks.ts @@ -4,7 +4,6 @@ import { NodeEnv, PromiseOrNot } from './utils'; import { RsbuildTarget } from './rsbuild'; import { BundlerChain } from './bundlerConfig'; import { mergeRsbuildConfig } from '../mergeRsbuildConfig'; -import type { RspackPluginInstance } from '@rspack/core'; export type OnBeforeBuildFn = (params: { bundlerConfigs?: BundlerConfig[]; diff --git a/packages/test-helper/src/index.ts b/packages/test-helper/src/index.ts index b00a2a2893..a516e38002 100644 --- a/packages/test-helper/src/index.ts +++ b/packages/test-helper/src/index.ts @@ -50,7 +50,7 @@ export function createSnapshotSerializer(options?: SnapshotSerializerOptions) { { mark: 'root', match: cwd }, { mark: 'workspace', match: workspace }, ...customMatchers, - ...createDefaultPathMatchers(workspace), + ...createDefaultPathMatchers(), ]; pathMatchers diff --git a/packages/test-helper/src/pathSerializer.ts b/packages/test-helper/src/pathSerializer.ts index a3b89a95fe..1420106d6a 100644 --- a/packages/test-helper/src/pathSerializer.ts +++ b/packages/test-helper/src/pathSerializer.ts @@ -50,7 +50,7 @@ export function applyMatcherReplacement( }, str); } -export const createDefaultPathMatchers = (root: string) => { +export const createDefaultPathMatchers = () => { const ret: PathMatcher[] = [ { match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/, diff --git a/scripts/tsconfig/base.json b/scripts/tsconfig/base.json index 7c6c43701b..d908d5b7ba 100644 --- a/scripts/tsconfig/base.json +++ b/scripts/tsconfig/base.json @@ -8,6 +8,8 @@ "isolatedModules": true, "esModuleInterop": true, "skipLibCheck": true, + "noUnusedLocals": true, + "noUnusedParameters": true, "jsx": "preserve", "resolveJsonModule": true, "moduleResolution": "Bundler"