diff --git a/eslint.config.mjs b/eslint.config.mjs index c85fb67..0956066 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -11,6 +11,27 @@ const compat = new FlatCompat({ const eslintConfig = [ ...compat.extends("next/core-web-vitals", "next/typescript"), + { + rules: { + // #495: this codebase has no components/ui barrel file today — every + // component is already imported directly by filename. This rule keeps + // it that way by rejecting any future `@/components/ui` (or a nested + // barrel under it) import before it can reintroduce the tree-shaking + // problem #495 was filed against. + "no-restricted-imports": [ + "error", + { + patterns: [ + { + group: ["@/components/ui", "@/components/ui/index"], + message: + "Import directly from the component's own file (e.g. '@/components/ui/Button'), not a barrel — barrel imports defeat tree-shaking (#495).", + }, + ], + }, + ], + }, + }, ]; export default eslintConfig;