Skip to main content

Getting started

eslint-plugin-vite is a flat-config-first ESLint plugin for catching Vite and Vitest configuration mistakes before they become runtime or build failures.

Installationโ€‹

npm install --save-dev @typpi/eslint-plugin-vite eslint

If your repository already uses Vite or Vitest, you do not need to change how those tools run just to adopt this plugin.

Quick startโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.recommended];

That preset already configures @typescript-eslint/parser for the files it targets.

Common compositionsโ€‹

Vite app with client-side env and glob usageโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.recommended, vite.configs.client];

Vitest monorepo with workspacesโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.recommended, vite.configs.vitest];

Repository with dedicated benchmark filesโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.recommended, vite.configs.vitest-bench];

Stricter rollout after the baseline is cleanโ€‹

import vite from "@typpi/eslint-plugin-vite";

export default [vite.configs.strict];

Choosing a presetโ€‹

  • recommended: best default starting point
  • strict: adds stricter env and workspace guidance
  • configs: focused only on config files
  • client: focused on import.meta.env and import.meta.glob
  • vitest: focused on Vitest config and workspaces
  • vitest-bench: focused on benchmark file hygiene

Next stepsโ€‹

Further readingโ€‹