UNPKG

vite-plugin-linter

Version:

Plugin for linting files with Vite

29 lines (27 loc) 791 B
#!/usr/bin/env node import { resolveConfig } from 'vite'; import { b as buildPluginName } from './shared/vite-plugin-linter.NKFpguQi.mjs'; import './lintWorkerThread.mjs'; import 'url'; import 'worker_threads'; import 'fs'; import 'path'; async function lint() { const config = await resolveConfig({}, "build"); const plugin = config.plugins.find((p) => p.name === buildPluginName); if (!plugin) { throw new Error(`Could not find plugin ${buildPluginName}`); } const outputLines = await plugin.lintFolder( process.cwd() ); if (outputLines.length > 0) { for (const output of outputLines) { console.warn(output); } console.error("Linting failed, see above output"); process.exit(1); } } global.vitePluginLinter = { mode: "lintCommand" }; lint();