no-empty-optimize-deps-include

July 3, 2026 · View on GitHub

Disallow empty optimizeDeps.include arrays in committed Vite config.

Rule catalog ID: R009

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