Skip to content

Add rule GCI2536 - Optimize browserslist tag in package.json#446

Open
Mr-R-b0t wants to merge 2 commits into
green-code-initiative:mainfrom
Mr-R-b0t:2536-JS
Open

Add rule GCI2536 - Optimize browserslist tag in package.json#446
Mr-R-b0t wants to merge 2 commits into
green-code-initiative:mainfrom
Mr-R-b0t:2536-JS

Conversation

@Mr-R-b0t

Copy link
Copy Markdown

No description provided.

@Mr-R-b0t Mr-R-b0t marked this pull request as draft May 19, 2026 15:43
@Mr-R-b0t Mr-R-b0t marked this pull request as ready for review May 20, 2026 11:54
@MP-Aubay MP-Aubay added 🗃️ rule rule improvment or rule development or bug js/ts labels May 20, 2026

@utarwyn utarwyn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 root browserslist if 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!

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

Labels

🗃️ rule rule improvment or rule development or bug js/ts

Projects

Development

Successfully merging this pull request may close these issues.

3 participants