Skip to main content

no-empty-worker-plugins

Disallow empty worker.plugins arrays in committed Vite config.

Rule catalog ID: R063

Targeted pattern scopeโ€‹

  • vite.config.*
  • worker.plugins

What this rule reportsโ€‹

This rule reports explicit worker.plugins: [] assignments in supported config files.

Why this rule existsโ€‹

An empty worker plugins list is usually accidental placeholder config. Removing no-op arrays keeps worker-specific behavior explicit.

โŒ Incorrectโ€‹

import { defineConfig } from "vite";

export default defineConfig({
worker: {
plugins: [],
},
});

โœ… Correctโ€‹

import { defineConfig } from "vite";

export default defineConfig({
worker: {
plugins: [() => ({ name: "worker-plugin" })],
},
});

Behavior and migration notesโ€‹

  • this rule checks static array literals only
  • remove worker.plugins when no worker plugins are needed

ESLint flat config exampleโ€‹

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

export default [vite.configs.configs];

When not to use itโ€‹

Disable this rule only if explicit empty plugin arrays are intentionally required in your configuration style.

Package documentationโ€‹

Further readingโ€‹