Add rule GCI2536 - Optimize browserslist tag in package.json#446
Add rule GCI2536 - Optimize browserslist tag in package.json#446Mr-R-b0t wants to merge 2 commits into
Conversation
utarwyn
left a comment
There was a problem hiding this comment.
Thanks for working on this rule! I've been thinking about the eco-design angle here and wanted to share a perspective that might help strengthen this rule.
The current rule focuses on splitting the configuration into a production key, which is great for structural organization. However, from a pure eco-design standpoint, the real impact comes from which browsers are actually targeted, not how the config is structured.
For example, this would currently be flagged as non-compliant:
{
"browserslist": "last 1 Chrome version"
}But this is already optimized for eco-design—it produces lean bundles with minimal polyfills!
What if we reframed the rule to directly measure the actual eco-design benefit?
Proposed focus:
- Ensure production builds target only modern browsers to minimize polyfills and bundle size
- This could be checked as: Does
browserslist.production(or rootbrowserslistif no split) use modern-only targets (e.g.,"last 2 versions","> 0.5%", avoiding old IE, etc.)?
This way:
- Projects already using modern browsers get recognized as eco-friendly
- Projects needing broader support can still use environment splitting without false positives
- The rule directly measures energy impact (smaller bundles)
Would love to hear your thoughts on this approach!
No description provided.