Skip to content

Bump browserslist to 4.28.9 and doiuse to 6.0.6 - #217

Merged
jsnmrs merged 1 commit into
mainfrom
fix/doiuse-caniuse-lite-crash
Sep 5, 2026
Merged

jsnmrs merged 1 commit into
mainfrom
fix/doiuse-caniuse-lite-crash

Conversation

@jsnmrs

@jsnmrs jsnmrs commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Supersedes #216, which fails CI.

The problem

The browserslist bump in #216 pulls caniuse-lite from 1.0.30001559 to 1.0.30001810, and npm run stylelint then crashes:

TypeError: Cannot read properties of undefined (reading 'B')
    at Object.unpackFeature (node_modules/caniuse-lite/dist/unpacker/feature.js:60:29)
    at BrowserSelection.compileBrowserSupport (node_modules/doiuse/exports/index.cjs:2578:46)

The lockfile pins doiuse@6.0.2 (a transitive dependency of stylelint-no-unsupported-browser-features). That version iterates its own feature list and hands each slug to caniuse's unpacker without checking whether caniuse-lite still carries it, so a removed slug arrives as undefined. doiuse@6.0.6 guards against it:

const packedFeature = caniuse__namespace.features[feature];
if (!packedFeature) continue; // Ignore removed features

stylelint-no-unsupported-browser-features@7.0.0 already declares doiuse: ^6.0.1, so 6.0.6 was in range all along — only the lockfile held it back, and CI's npm install honors the lockfile.

The change

npm update browserslist doiuse, which resolves to browserslist 4.28.9, caniuse-lite 1.0.30001810, and doiuse 6.0.6. All three are transitive, so package.json is unchanged and the lockfile stays at lockfileVersion 2.

Verification

Reproduced both directions in an isolated sandbox using this repo's .stylelintrc, .browserslistrc, and _sass:

doiuse caniuse-lite stylelint exit
6.0.2 1.0.30001810 1 — the TypeError above
6.0.6 1.0.30001810 0 — clean, no new browser-feature warnings

On this branch:

  • npm run stylelint — exit 0, and --fix leaves _sass/ untouched
  • npm run test-content — exit 0
  • npx tape tests/*.test.js — 200/200 pass

bundle exec jekyll build was not run locally (gems not installed); it already passes in CI and is unaffected by a lockfile change.

Follow-up

Not addressed here: stylelint 15 is end-of-life and about 50 rules in .stylelintrc are deprecated. Stylelint 16 removes them, and stylelint-no-unsupported-browser-features@8.x requires stylelint 16 or newer. Worth its own issue.

The browserslist bump pulls caniuse-lite up to 1.0.30001810, which
doiuse 6.0.2 cannot read: it passes every slug in its own feature list
to caniuse's unpacker without checking whether caniuse-lite still
carries it, so stylelint dies with "Cannot read properties of undefined
(reading 'B')". doiuse 6.0.6 skips removed features instead.

Both packages are transitive, so only the lockfile changes.
@jsnmrs
jsnmrs merged commit e4252fe into main Sep 5, 2026
1 check passed
@jsnmrs
jsnmrs deleted the fix/doiuse-caniuse-lite-crash branch September 5, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant