Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting plugin for BundlePhobia #192

Open
addyosmani opened this issue Jul 9, 2019 · 0 comments
Open

Linting plugin for BundlePhobia #192

addyosmani opened this issue Jul 9, 2019 · 0 comments

Comments

@addyosmani
Copy link

Please describe the feature/suggestion

I would like to propose a linting plugin that builds on top of BundlePhobia's alternative package recommendations.

I believe this would improve awareness and adoption of small packages. It would also form a nice bridge between this project and other common entry-points for building webapps (e.g package manager CLIs, framework CLIs, bundlers etc).

Describe the solution you'd like

It would be really powerful if there was a BundlePhobia webpack, babel or ESLint plugin that could lint for usage of popular large dependencies and suggest alternatives. Something that could potentially integrate with an npm/yarn preinstall step so maybe even recommendations are made before users perform an install.

Something like:

$ npm install moment 
$ > bundle-lint found 3 smaller alternatives for your consideration. 
> How would you like to proceed?
[  ] install luxon [19.29KB min/gzip - 71% smaller]
[  ] install date-fns [2.74KB min/gzip - 90% smaller]
[  ] install dayjs [6.54KB - 90% smaller]
[  ] install moment

(could even include brief notes on which support timezones/locales)

There are also lots of directions one could take linting - you could scan their source/package.json to understand if there are specific features in moment being used and suggest the best "fit", saving the author from more research before making a decision.

$ npm install moment 
$ > bundle-lint found 3 smaller alternatives for your consideration. 
> How would you like to proceed?
[  ] install luxon [19.29KB min/gzip - 71% smaller] - recommended (closest match for you)
[  ] list more alternatives
[  ] install moment

Describe any alternatives you've considered

Alternatives today include using ESLint and the no-restricted-imports rule to disallow known large imports. This often ends up a manually curated effort however. I think BundlePhobia is in a good position to offer a data-driven solution to this problem... :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant