Skip to main content

no-empty-optimize-deps-include

Disallow empty optimizeDeps.include arrays in committed Vite config.

Rule catalog ID: R059

Targeted pattern scopeโ€‹

  • vite.config.*
  • optimizeDeps.include

What this rule reportsโ€‹

This rule reports explicit optimizeDeps.include: [] assignments in supported config files.

Why this rule existsโ€‹

An empty include list is a no-op and usually represents stale or accidental config. Keeping optimize-deps settings explicit improves readability and intent.

โŒ Incorrectโ€‹

import { defineConfig } from "vite";

export default defineConfig({
optimizeDeps: {
include: [],
},
});

โœ… Correctโ€‹

import { defineConfig } from "vite";

export default defineConfig({
optimizeDeps: {
include: ["react"],
},
});

Behavior and migration notesโ€‹

  • this rule checks static array literals only
  • remove the option entirely when you have no entries

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 your team intentionally uses explicit empty arrays as placeholders.

Package documentationโ€‹

Further readingโ€‹