eslint-plugin-better-tree-shaking
ESLint plugin to improve tree-shaking of library code
Improve tree-shaking of your app or library by detecting top-level side-effects that bundlers can't eliminate. The plugin suggests annotating them with /* @__PURE__ */ comments.
Examples
Top-level side effects prevent bundlers from tree-shaking unused exports. Here are common patterns and their fixes:
Setup with ESLint
Install the eslint-plugin-better-tree-shaking package.
Add better-tree-shaking to the plugins section of your ESLint configuration file and Add thebetter-tree-shaking/no-top-level-side-effects rule to the rules section.