chore: enable some eslint rules (#18084)

Co-authored-by: 翠 / green <green@sapphi.red>
This commit is contained in:
Bjorn Lu 2024-09-12 17:28:36 +08:00 committed by GitHub
parent 35cf59c9d5
commit e9a2746ca7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 93 additions and 92 deletions

View File

@ -96,7 +96,7 @@ export default tseslint.config(
],
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/no-unsafe-function-type': 'off', // TODO: we should turn this on in a new PR
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': [
'error',
{ allowArgumentsExplicitlyTypedAsAny: true },
@ -107,26 +107,33 @@ export default tseslint.config(
],
'@typescript-eslint/no-empty-object-type': [
'error',
{ allowInterfaces: 'with-single-extends' }, // maybe we should turn this on in a new PR
{ allowInterfaces: 'with-single-extends' },
],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-explicit-any': 'off',
'no-extra-semi': 'off',
'@typescript-eslint/no-extra-semi': 'off', // conflicts with prettier
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-unused-expressions': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports', disallowTypeAnnotations: false },
],
// disable rules set in @typescript-eslint/stylistic which conflict with current code
// maybe we should turn them on in a new PR
// we should discuss if we want to enable these as they encourage consistent code
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/ban-tslint-comment': 'off',
'@typescript-eslint/consistent-generic-constructors': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'@typescript-eslint/prefer-function-type': 'off',
@ -270,6 +277,8 @@ export default tseslint.config(
'n/no-unsupported-features/es-builtins': 'off',
'n/no-unsupported-features/node-builtins': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-undef': 'off',
'no-empty': 'off',
'no-constant-condition': 'off',
@ -298,6 +307,7 @@ export default tseslint.config(
name: 'disables/dts',
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/triple-slash-reference': 'off',
},
},

View File

@ -20,7 +20,7 @@ export default defineBuildConfig({
prompts: 'prompts/lib/index.js',
},
hooks: {
'rollup:options'(ctx, options) {
'rollup:options'(_ctx, options) {
options.plugins = [
options.plugins,
// @ts-expect-error TODO: unbuild uses rollup v3 and Vite uses rollup v4

View File

@ -115,7 +115,7 @@ function toAssetPathFromHtml(
config: ResolvedConfig,
): string {
const relativeUrlPath = normalizePath(path.relative(config.root, htmlPath))
const toRelative = (filename: string, hostId: string) =>
const toRelative = (filename: string, _hostId: string) =>
getBaseInHTML(relativeUrlPath, config) + filename
return toOutputFilePathInHtml(
filename,
@ -296,11 +296,12 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
if (!modernPolyfills.size) {
return
}
isDebug &&
if (isDebug) {
console.log(
`[@vitejs/plugin-legacy] modern polyfills:`,
modernPolyfills,
)
}
const polyfillChunk = await buildPolyfillChunk(
config.mode,
modernPolyfills,
@ -338,11 +339,12 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
}
if (legacyPolyfills.size || !options.externalSystemJS) {
isDebug &&
if (isDebug) {
console.log(
`[@vitejs/plugin-legacy] legacy polyfills:`,
legacyPolyfills,
)
}
await buildPolyfillChunk(
config.mode,
@ -377,8 +379,9 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
config = _config
modernTargets = options.modernTargets || modernTargetsBabel
isDebug &&
if (isDebug) {
console.log(`[@vitejs/plugin-legacy] modernTargets:`, modernTargets)
}
if (!genLegacy || config.build.ssr) {
return
@ -388,7 +391,9 @@ function viteLegacyPlugin(options: Options = {}): Plugin[] {
options.targets ||
browserslistLoadConfig({ path: config.root }) ||
'last 2 versions and not dead, > 0.3%, Firefox ESR'
isDebug && console.log(`[@vitejs/plugin-legacy] targets:`, targets)
if (isDebug) {
console.log(`[@vitejs/plugin-legacy] targets:`, targets)
}
const getLegacyOutputFileName = (
fileNames:

View File

@ -2,7 +2,7 @@ export interface Options {
/**
* default: 'defaults'
*/
targets?: string | string[] | { [key: string]: string }
targets?: string | string[] | Record<string, string>
/**
* default: 'edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12'
*/

View File

@ -5,7 +5,7 @@ if (!import.meta.url.includes('node_modules')) {
try {
// only available as dev dependency
await import('source-map-support').then((r) => r.default.install())
} catch (e) {}
} catch {}
}
global.__vite_start_time = performance.now()

View File

@ -1,4 +1,3 @@
declare const __MODE__: string
declare const __DEFINES__: Record<string, any>
const context = (() => {

View File

@ -114,7 +114,9 @@ export class ModuleCacheMap extends Map<string, ModuleCache> {
const subIds = Array.from(super.entries())
.filter(([, mod]) => mod.importers?.has(id))
.map(([key]) => key)
subIds.length && this.invalidateSubDepTree(subIds, invalidated)
if (subIds.length) {
this.invalidateSubDepTree(subIds, invalidated)
}
super.delete(id)
}
return invalidated

View File

@ -364,7 +364,7 @@ export class ModuleRunner {
dirname: isWindows ? toWindowsPath(dirname) : dirname,
url: href,
env: this.envProxy,
resolve(id, parent) {
resolve(_id, _parent) {
throw new Error(
'[module runner] "import.meta.resolve" is not supported.',
)
@ -437,7 +437,7 @@ function exportAll(exports: any, sourceModule: any) {
configurable: true,
get: () => sourceModule[key],
})
} catch (_err) {}
} catch {}
}
}
}

View File

@ -21,7 +21,7 @@ export interface InterceptorOptions {
const sourceMapCache: Record<string, CachedMapEntry> = {}
const fileContentsCache: Record<string, string> = {}
const moduleGraphs: Set<ModuleCacheMap> = new Set()
const moduleGraphs = new Set<ModuleCacheMap>()
const retrieveFileHandlers = new Set<RetrieveFileHandler>()
const retrieveSourceMapHandlers = new Set<RetrieveSourceMapHandler>()

View File

@ -227,7 +227,7 @@ async function createCssPluginTransform(
const mockFs = vi
.spyOn(fs, 'readFile')
// @ts-expect-error vi.spyOn not recognize override `fs.readFile` definition.
.mockImplementationOnce((p, encoding, callback) => {
.mockImplementationOnce((p, _encoding, callback) => {
callback(null, Buffer.from(files?.[p] ?? ''))
})

View File

@ -95,7 +95,7 @@ export function createIsConfiguredAsExternal(
// configured as external
!!configuredAsExternal,
)?.external
} catch (e) {
} catch {
debug?.(
`Failed to node resolve "${id}". Skipping externalizing it by default.`,
)

View File

@ -367,7 +367,7 @@ export async function loadCachedDepOptimizationMetadata(
await fsp.readFile(cachedMetadataPath, 'utf-8'),
depsCacheDir,
)
} catch (e) {}
} catch {}
// hash is consistent, no need to re-bundle
if (cachedMetadata) {
if (cachedMetadata.lockfileHash !== getLockfileHash(environment)) {
@ -508,7 +508,7 @@ export function runOptimizeDeps(
try {
// When exiting the process, `fsp.rm` may not take effect, so we use `fs.rmSync`
fs.rmSync(processingCacheDir, { recursive: true, force: true })
} catch (error) {
} catch {
// Ignore errors
}
}
@ -1286,7 +1286,7 @@ export async function cleanupDepsCacheStaleDirs(
for (const dirent of dirents) {
if (dirent.isDirectory() && dirent.name.includes('_temp_')) {
const tempDirPath = path.resolve(config.cacheDir, dirent.name)
const stats = await fsp.stat(tempDirPath).catch((_) => null)
const stats = await fsp.stat(tempDirPath).catch(() => null)
if (
stats?.mtime &&
Date.now() - stats.mtime.getTime() > MAX_TEMP_DIR_AGE_MS
@ -1331,7 +1331,7 @@ const safeRename = promisify(function gracefulRename(
Date.now() - start < GRACEFUL_RENAME_TIMEOUT
) {
setTimeout(function () {
fs.stat(to, function (stater, st) {
fs.stat(to, function (stater, _st) {
if (stater && stater.code === 'ENOENT') fs.rename(from, to, CB)
else CB(er)
})

View File

@ -14,7 +14,7 @@ import type {
ResolvedConfig,
UserConfig,
} from './config'
import type { ServerHook, ViteDevServer } from './server'
import type { ServerHook } from './server'
import type { IndexHtmlTransform } from './plugins/html'
import type { EnvironmentModuleNode } from './server/moduleGraph'
import type { ModuleNode } from './server/mixedModuleGraph'

View File

@ -9,7 +9,7 @@ export function completeSystemWrapPlugin(): Plugin {
return {
name: 'vite:force-systemjs-wrap-complete',
renderChunk(code, chunk, opts) {
renderChunk(code, _chunk, opts) {
if (opts.format === 'system') {
return {
code: code.replace(SystemJSWrapRE, (s, s1) =>

View File

@ -210,6 +210,7 @@ const enum PreprocessLang {
styl = 'styl',
stylus = 'stylus',
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- bug in typescript-eslint
const enum PureCssLang {
css = 'css',
}
@ -964,7 +965,7 @@ export function cssAnalysisPlugin(config: ResolvedConfig): Plugin {
return {
name: 'vite:css-analysis',
async transform(_, id, options) {
async transform(_, id) {
if (
!isCSSRequest(id) ||
commonjsProxyRE.test(id) ||
@ -2056,7 +2057,7 @@ function loadSassPackage(root: string): {
try {
const path = loadPreprocessorPath(PreprocessLang.sass, root)
return { name: 'sass', path }
} catch (e2) {
} catch {
throw e1
}
}
@ -2173,9 +2174,11 @@ const makeScssWorker = (
}
const importer = [_internalImporter]
if (options.importer) {
Array.isArray(options.importer)
? importer.unshift(...options.importer)
: importer.unshift(options.importer)
if (Array.isArray(options.importer)) {
importer.unshift(...options.importer)
} else {
importer.unshift(options.importer)
}
}
const finalOptions: Sass.LegacyOptions<'async'> = {
@ -2847,7 +2850,7 @@ const stylProcessor = (
worker.stop()
}
},
async process(environment, source, root, options, resolvers) {
async process(_environment, source, root, options, _resolvers) {
const stylusPath = loadPreprocessorPath(PreprocessLang.stylus, root)
if (!workerMap.has(options.alias)) {

View File

@ -207,7 +207,7 @@ export function dynamicImportVarsPlugin(config: ResolvedConfig): Plugin {
let imports: readonly ImportSpecifier[] = []
try {
imports = parseImports(source)[0]
} catch (e: any) {
} catch {
// ignore as it might not be a JS file, the subsequent plugins will catch the error
return null
}

View File

@ -152,10 +152,10 @@ export async function transformWithEsbuild(
// esbuild uses tsconfig fields when both the normal options and tsconfig was set
// but we want to prioritize the normal options
if (options) {
options.jsx && (compilerOptions.jsx = undefined)
options.jsxFactory && (compilerOptions.jsxFactory = undefined)
options.jsxFragment && (compilerOptions.jsxFragmentFactory = undefined)
options.jsxImportSource && (compilerOptions.jsxImportSource = undefined)
if (options.jsx) compilerOptions.jsx = undefined
if (options.jsxFactory) compilerOptions.jsxFactory = undefined
if (options.jsxFragment) compilerOptions.jsxFragmentFactory = undefined
if (options.jsxImportSource) compilerOptions.jsxImportSource = undefined
}
tsconfigRaw = {

View File

@ -338,8 +338,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
const publicPath = `/${relativeUrlPath}`
const publicBase = getBaseInHTML(relativeUrlPath, config)
const publicToRelative = (filename: string, importer: string) =>
publicBase + filename
const publicToRelative = (filename: string) => publicBase + filename
const toOutputPublicFilePath = (url: string) =>
toOutputFilePathInHtml(
url.slice(1),
@ -694,7 +693,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
},
async generateBundle(options, bundle) {
const analyzedChunk: Map<OutputChunk, number> = new Map()
const analyzedChunk = new Map<OutputChunk, number>()
const inlineEntryChunk = new Set<string>()
const getImportedChunks = (
chunk: OutputChunk,
@ -797,7 +796,7 @@ export function buildHtmlPlugin(config: ResolvedConfig): Plugin {
relativeUrlPath,
'html',
config,
(filename: string, importer: string) => assetsBase + filename,
(filename) => assetsBase + filename,
)
}
}

View File

@ -513,7 +513,7 @@ export function buildImportAnalysisPlugin(config: ResolvedConfig): Plugin {
if (rawUrl[0] === `"` && rawUrl[rawUrl.length - 1] === `"`)
url = rawUrl.slice(1, -1)
}
const deps: Set<string> = new Set()
const deps = new Set<string>()
let hasRemovedPureCssChunk = false
let normalizedFile: string | undefined = undefined

View File

@ -220,7 +220,7 @@ export async function parseImportGlob(
let cleanCode: string
try {
cleanCode = stripLiteral(code)
} catch (e) {
} catch {
// skip invalid js code
return []
}

View File

@ -44,7 +44,7 @@ export async function resolvePlugins(
)
return [
depOptimizationEnabled ? optimizedDepsPlugin(config) : null,
depOptimizationEnabled ? optimizedDepsPlugin() : null,
isBuild ? metadataPlugin() : null,
!isWorker ? watchPackageDataPlugin(config.packageCache) : null,
preAliasPlugin(config),
@ -81,7 +81,7 @@ export async function resolvePlugins(
},
isBuild,
),
wasmHelperPlugin(config),
wasmHelperPlugin(),
webWorkerPlugin(config),
assetPlugin(config),

View File

@ -14,7 +14,7 @@ export function buildLoadFallbackPlugin(): Plugin {
const content = await fsp.readFile(cleanedId, 'utf-8')
this.addWatchFile(cleanedId)
return content
} catch (e) {
} catch {
const content = await fsp.readFile(id, 'utf-8')
this.addWatchFile(id)
return content

View File

@ -134,7 +134,7 @@ export function manifestPlugin(): Plugin {
try {
const fileName = this.getFileName(id)
entryCssAssetFileNames.add(fileName)
} catch (error: unknown) {
} catch {
// The asset was generated as part of a different output option.
// It was already handled during the previous run of this plugin.
assets.delete(id)

View File

@ -1,6 +1,6 @@
import fsp from 'node:fs/promises'
import colors from 'picocolors'
import type { DevEnvironment, ResolvedConfig } from '..'
import type { DevEnvironment } from '..'
import type { Plugin } from '../plugin'
import { DEP_VERSION_RE } from '../constants'
import { createDebugger } from '../utils'
@ -15,7 +15,7 @@ export const ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR =
const debug = createDebugger('vite:optimize-deps')
export function optimizedDepsPlugin(config: ResolvedConfig): Plugin {
export function optimizedDepsPlugin(): Plugin {
return {
name: 'vite:optimized-deps',
@ -70,7 +70,7 @@ export function optimizedDepsPlugin(config: ResolvedConfig): Plugin {
// we are sure that the file has been properly save to disk
try {
return await fsp.readFile(file, 'utf-8')
} catch (e) {
} catch {
const newMetadata = depsOptimizer.metadata
if (optimizedDepInfoFromFile(newMetadata, file)) {
// Outdated non-entry points (CHUNK), loaded after a rerun

View File

@ -598,7 +598,6 @@ export function tryFsResolve(
fsPath: string,
options: InternalResolveOptions,
tryIndex = true,
targetWeb = true,
skipPackageJson = false,
): string | undefined {
// Dependencies like es5-ext use `#` in their paths. We don't support `#` in user
@ -610,25 +609,13 @@ export function tryFsResolve(
// We only need to check foo#bar?baz and foo#bar, ignore foo?bar#baz
if (queryIndex < 0 || queryIndex > hashIndex) {
const file = queryIndex > hashIndex ? fsPath.slice(0, queryIndex) : fsPath
const res = tryCleanFsResolve(
file,
options,
tryIndex,
targetWeb,
skipPackageJson,
)
const res = tryCleanFsResolve(file, options, tryIndex, skipPackageJson)
if (res) return res + fsPath.slice(file.length)
}
}
const { file, postfix } = splitFileAndPostfix(fsPath)
const res = tryCleanFsResolve(
file,
options,
tryIndex,
targetWeb,
skipPackageJson,
)
const res = tryCleanFsResolve(file, options, tryIndex, skipPackageJson)
if (res) return res + postfix
}
@ -639,7 +626,6 @@ function tryCleanFsResolve(
file: string,
options: InternalResolveOptions,
tryIndex = true,
targetWeb = true,
skipPackageJson = false,
): string | undefined {
const { tryPrefix, extensions, preserveSymlinks } = options
@ -1104,7 +1090,6 @@ export function resolvePackageEntry(
entryPointPath,
options,
true,
true,
skipPackageJson,
)
if (resolvedEntryPoint) {
@ -1228,7 +1213,6 @@ function resolveDeepImport(
path.join(dir, relativeId),
options,
!exportsField, // try index only if no exports field
!!options.webCompatible,
)
if (resolved) {
debug?.(

View File

@ -1,4 +1,3 @@
import type { ResolvedConfig } from '../config'
import type { Plugin } from '../plugin'
import { fileToUrl } from './asset'
@ -47,7 +46,7 @@ const wasmHelper = async (opts = {}, url: string) => {
const wasmHelperCode = wasmHelper.toString()
export const wasmHelperPlugin = (config: ResolvedConfig): Plugin => {
export const wasmHelperPlugin = (): Plugin => {
return {
name: 'vite:wasm-helper',

View File

@ -244,7 +244,7 @@ export function webWorkerPlugin(config: ResolvedConfig): Plugin {
}
},
async transform(raw, id, options) {
async transform(raw, id) {
const workerFileMatch = workerFileRE.exec(id)
if (workerFileMatch) {
// if import worker by worker constructor will have query.type

View File

@ -29,7 +29,7 @@ describe('plugin container', () => {
return { code: 'export {}', meta: { x: 2 } }
}
},
transform(code, id) {
transform(_code, id) {
if (id === entryUrl) {
const { meta } = this.getModuleInfo(entryUrl) ?? {}
metaArray.push(meta)
@ -191,7 +191,7 @@ describe('plugin container', () => {
if (id === entryUrl) return { code: '1' }
else if (id === otherUrl) return { code: '2', meta: { code: '2' } }
},
async transform(code, id) {
async transform(_code, id) {
if (id === entryUrl) {
// NOTE: ModuleInfo.code not implemented, used `.meta.code` for now
return (await this.load({ id: otherUrl }))?.meta.code

View File

@ -13,7 +13,7 @@ export function htmlFallbackMiddleware(
fsUtils: FsUtils = commonFsUtils,
): Connect.NextHandleFunction {
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
return function viteHtmlFallbackMiddleware(req, res, next) {
return function viteHtmlFallbackMiddleware(req, _res, next) {
if (
// Only accept GET or HEAD
(req.method !== 'GET' && req.method !== 'HEAD') ||

View File

@ -169,7 +169,7 @@ const processNodeUrl = (
if (preTransformUrl) {
try {
preTransformUrl = decodeURI(preTransformUrl)
} catch (err) {
} catch {
// Malformed uri. Skip pre-transform.
return url
}

View File

@ -89,7 +89,7 @@ export function proxyMiddleware(
opts.configure(proxy, opts)
}
proxy.on('error', (err, req, originalRes) => {
proxy.on('error', (err, _req, originalRes) => {
// When it is ws proxy, res is net.Socket
// originalRes can be falsy if the proxy itself errored
const res = originalRes as http.ServerResponse | net.Socket | undefined
@ -127,7 +127,7 @@ export function proxyMiddleware(
}
})
proxy.on('proxyReqWs', (proxyReq, req, socket, options, head) => {
proxy.on('proxyReqWs', (proxyReq, _req, socket, options) => {
rewriteOriginHeader(proxyReq, options, config)
socket.on('error', (err) => {
@ -143,7 +143,7 @@ export function proxyMiddleware(
// https://github.com/http-party/node-http-proxy/issues/1520#issue-877626125
// https://github.com/chimurai/http-proxy-middleware/blob/cd58f962aec22c925b7df5140502978da8f87d5f/src/plugins/default/debug-proxy-errors-plugin.ts#L25-L37
proxy.on('proxyRes', (proxyRes, req, res) => {
proxy.on('proxyRes', (proxyRes, _req, res) => {
res.on('close', () => {
if (!res.writableEnded) {
debug?.('destroying proxyRes in proxyRes close event')

View File

@ -73,7 +73,7 @@ export function servePublicMiddleware(
if (filePath.indexOf('%') !== -1) {
try {
filePath = decodeURI(filePath)
} catch (err) {
} catch {
/* malform uri */
}
}

View File

@ -128,7 +128,7 @@ export function transformMiddleware(
return send(req, res, JSON.stringify(map), 'json', {
headers: server.config.server.headers,
})
} catch (e) {
} catch {
// Outdated source map request for optimized deps, this isn't an error
// but part of the normal flow when re-optimizing after missing deps
// Send back an empty source map so the browser doesn't issue warnings

View File

@ -271,7 +271,7 @@ export class ModuleGraph {
async getModuleByUrl(
url: string,
ssr?: boolean,
_ssr?: boolean,
): Promise<ModuleNode | undefined> {
// In the mixed graph, the ssr flag was used to resolve the id.
const [clientModule, ssrModule] = await Promise.all([
@ -333,7 +333,7 @@ export class ModuleGraph {
invalidateModule(
mod: ModuleNode,
seen: Set<ModuleNode> = new Set(),
seen = new Set<ModuleNode>(),
timestamp: number = Date.now(),
isHmr: boolean = false,
/** @internal */

View File

@ -164,7 +164,7 @@ export class EnvironmentModuleGraph {
invalidateModule(
mod: EnvironmentModuleNode,
seen: Set<EnvironmentModuleNode> = new Set(),
seen = new Set<EnvironmentModuleNode>(),
timestamp: number = Date.now(),
isHmr: boolean = false,
/** @internal */

View File

@ -104,7 +104,7 @@ async function startBrowserProcess(
)
return true
}
} catch (err) {
} catch {
// Ignore errors
}
}
@ -135,7 +135,7 @@ async function startBrowserProcess(
})
return true
} catch (err) {
} catch {
return false
}
}

View File

@ -633,7 +633,7 @@ class PluginContext implements Omit<RollupPluginContext, 'cache'> {
return [...this._container.watchFiles]
}
emitFile(assetOrFile: EmittedFile): string {
emitFile(_assetOrFile: EmittedFile): string {
this._warnIncompatibleMethod(`emitFile`)
return ''
}

View File

@ -9,7 +9,7 @@ export type NonNeverKeys<T> = {
}[keyof T]
export type GetHookContextMap<Plugin> = {
[K in keyof Plugin]-?: Plugin[K] extends ObjectHook<infer T, infer B>
[K in keyof Plugin]-?: Plugin[K] extends ObjectHook<infer T, unknown>
? T extends (this: infer This, ...args: any[]) => any
? This extends RollupPluginContext
? This

View File

@ -351,7 +351,7 @@ export function createInMemoryLogger(logs: string[]): Logger {
function setupConsoleWarnCollector(logs: string[]) {
const warn = console.warn
console.warn = (...args) => {
serverLogs.push(args.join(' '))
logs.push(args.join(' '))
return warn.call(console, ...args)
}
}