import { FilterPattern } from '@rollup/pluginutils'; import { Plugin } from 'vite'; type LinterResult = { [file: string]: T; }; interface Linter { /** * Name of the linter. Must be unique */ name: string; /** * Format the output for displaying to the user * @param results Linting results to format */ format(results: readonly T[]): Promise; /** * Lint files during the build command * @param files Files to lint */ lintBuild(files: string[]): Promise; /** * Lint files during the serve command * @param files Files to lint * @param output Call when results from linting are available */ lintServe(files: string[], output: (result: LinterResult) => void): void; } type IncludeMode = "processedFiles" | "filesInFolder"; interface LinterPluginOptions { /** * Options used when called via the build command */ build?: { /** * If the plugin should not execute when called via the build command */ disable?: boolean; /** * Which files to lint when called via the build command * processedFiles lints only the files processed by Vite (default) * filesInFolder lints all files in the project folder */ includeMode?: IncludeMode; }; /** * Options used when called via the serve command */ serve?: { /** * If the plugin should not execute when called via the serve command */ disable?: boolean; /** * Which files to lint when called via the serve command * processedFiles lints only the files processed by Vite (default) * filesInFolder lints all files in the project folder */ includeMode?: IncludeMode; }; /** * File(s) to exclude. Defaults to /node_modules/ (Ex: .\src\mine.ts) */ exclude?: FilterPattern; /** * File(s) to include. (Ex: .\src\**\*.ts) */ include?: FilterPattern; /** * File to inject the browser console logging code into. Defaults to the first file not in node_modules */ injectFile?: string; /** * Linters to run */ linters: Linter[]; } type LinterResultData = any; declare function linterPlugin(options?: LinterPluginOptions): Plugin[]; export { linterPlugin as l }; export type { IncludeMode as I, LinterResultData as L, LinterResult as a, Linter as b, LinterPluginOptions as c };