Skip to content

Babel v8 upgrade and eslint warning clean-up - #2100

Open
stefcameron wants to merge 2 commits into
masterfrom
babel-upgrade
Open

Babel v8 upgrade and eslint warning clean-up#2100
stefcameron wants to merge 2 commits into
masterfrom
babel-upgrade

Conversation

@stefcameron

@stefcameron stefcameron commented Jun 17, 2026

Copy link
Copy Markdown
Member
PR Checklist

Please leave this checklist in your PR.

  • Source changes maintain stated browser compatibility.
  • Web APIs introduced have deep browser coverage, including Safari (often very late to adopt new APIs).
  • Issue being fixed is referenced.
  • Unit test coverage added/updated.
  • E2E test coverage added/updated.
  • Typings added/updated.
  • Changes do not break SSR:
    • Careful to test typeof document/window !== 'undefined' before using it in code that gets executed on load.
  • README updated (API changes, instructions, etc.).
  • Changes to dependencies explained.
  • Changeset added (run npm run changeset locally to add one, and follow the prompts).
    • EXCEPTION: A Changeset is not required if the change does not affect any of the source files that produce the package bundle. For example, demo changes, tooling changes, test updates, or a new dev-only dependency to run tests more efficiently should not have a Changeset since it will not affect package consumers.

Summary by CodeRabbit

Release Notes

  • Chores
    • Upgraded Babel toolchain dependencies to the newer v8 ecosystem and adjusted related plugin configuration.
    • Cleaned up formatting and linting configuration headers across project and test support files.
  • Tests
    • Removed Cypress code-coverage instrumentation from the E2E setup/CI step, while keeping the test execution flow the same.

@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c778ad7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@stefcameron

Copy link
Copy Markdown
Member Author

❗ This is currently blocked on @cypress/code-coverage@"^4.0.3 still requiring babel 7, causing npm install to fail.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e14775a-a755-4259-80fb-3c244d5c2e5f

📥 Commits

Reviewing files that changed from the base of the PR and between 6a365c8 and c778ad7.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • cypress/plugins/index.js
  • cypress/support/e2e.js
  • package.json
💤 Files with no reviewable changes (4)
  • .github/workflows/ci.yml
  • cypress/plugins/index.js
  • cypress/support/e2e.js
  • package.json

Walkthrough

Upgrades Babel devDependencies from v7 to v8 with updated plugin names and preset-env configuration. Removes @cypress/code-coverage instrumentation from the test suite and its related integrations. Also deletes obsolete /* eslint-env node */ directive comments from config and test files—basically throwing out the digital equivalent of sticky notes from 2019.

Changes

Babel v8 Upgrade and Dependencies

Layer / File(s) Summary
Babel v8 dependencies and plugin names
package.json
Upgrades @babel/core, @babel/eslint-parser, @babel/eslint-plugin, and @babel/preset-env from ^7.x to ^8.0.0. Replaces @babel/plugin-proposal-nullish-coalescing-operator and @babel/plugin-proposal-optional-chaining with their @babel/plugin-transform-* counterparts at v8.0.1.
Babel preset-env assumptions and exclude configuration
babel.config.js
Updates plugin names to match v8, introduces top-level assumptions and exclude constants, and wires both into @babel/preset-env options for es5 and esm environments.

Code Coverage Removal and Directive Cleanup

Layer / File(s) Summary
Code coverage instrumentation removal
package.json, cypress/plugins/index.js, cypress/support/e2e.js, .github/workflows/ci.yml
Removes @cypress/code-coverage from devDependencies. Removes the config.env.coverage === true conditional in the Cypress plugins file that registered coverage tasks and configured Babel preprocessing. Removes the @cypress/code-coverage/support import from the Cypress support file. Removes an inline coverage comment from the CI workflow's E2E test step.
ESLint environment directive cleanup
.prettierrc.js, rollup.config.mjs, test/debug.js, test/fixtures/fixtures.js, index.d.ts
Deletes /* eslint-env node */ header comments and one inline ESLint suppression comment. No logic or type signatures are altered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • focus-trap/tabbable#2086: Involves babel.config.js and env.dev Babel setup, which is directly affected by the plugin renames and preset-env wiring changes in this PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains the checklist template without any substantive explanation of what was changed, why, or how the Babel 8 upgrade and ESLint cleanup were accomplished. Add a brief summary above the checklist explaining the Babel 7→8 upgrade, the removal of @cypress/code-coverage dependency due to incompatibility, and the eslint-env comment cleanup across the codebase.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: upgrading Babel to v8 and removing ESLint warning-related comments and the code coverage dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch babel-upgrade

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
babel.config.js (1)

48-48: ⚠️ Potential issue | 🟠 Major

Remove loose: true from the dev environment preset—it's a Babel 8 zombie option.

Line 48 uses loose: true in the dev environment, but this option was removed in Babel 8 in favor of top-level assumptions. The dev config is also inconsistent with es5 and esm, which both correctly use the assumptions and exclude patterns. All the pieces are already there—just need to align it.

Suggested fix
     dev: {
       presets: [
-        ['`@babel/preset-env`', { targets: { esmodules: true }, loose: true }],
+        ['`@babel/preset-env`', { targets: { esmodules: true }, exclude }],
       ],
+      assumptions,
       plugins,
     },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@babel.config.js` at line 48, The `dev` environment preset at line 48 includes
`loose: true`, which is a deprecated Babel 8 option that was removed in favor of
top-level `assumptions`. Remove the `loose: true` property from the
`@babel/preset-env` preset configuration in the `dev` environment, and align it
with the existing patterns in the `es5` and `esm` environment configurations by
using the appropriate `assumptions` and `exclude` properties instead to maintain
consistency across all environments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 55-60: The Babel 8 packages in package.json require Node ^22.18.0
or >=24.11.0, but the release workflow in .github/workflows/release.yml is
pinned to Node 20, which will cause the release CI to fail when running npm run
test. To fix this, update the Node version in the release.yml workflow to Node
22 or latest to match the test CI configuration, and add an engines field to
package.json specifying the required Node version (e.g., "engines": { "node":
"^22.18.0" }) to prevent incompatible installations and alert contributors
early.

---

Outside diff comments:
In `@babel.config.js`:
- Line 48: The `dev` environment preset at line 48 includes `loose: true`, which
is a deprecated Babel 8 option that was removed in favor of top-level
`assumptions`. Remove the `loose: true` property from the `@babel/preset-env`
preset configuration in the `dev` environment, and align it with the existing
patterns in the `es5` and `esm` environment configurations by using the
appropriate `assumptions` and `exclude` properties instead to maintain
consistency across all environments.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5677f8c6-ee02-4b98-9481-3a702f584526

📥 Commits

Reviewing files that changed from the base of the PR and between 86bb919 and 6a365c8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (8)
  • .prettierrc.js
  • babel.config.js
  • eslint.config.mjs
  • index.d.ts
  • package.json
  • rollup.config.mjs
  • test/debug.js
  • test/fixtures/fixtures.js
💤 Files with no reviewable changes (6)
  • .prettierrc.js
  • eslint.config.mjs
  • test/fixtures/fixtures.js
  • test/debug.js
  • rollup.config.mjs
  • index.d.ts

Comment thread package.json
Comment on lines +55 to +60
"@babel/core": "^8.0.0",
"@babel/eslint-parser": "^8.0.0",
"@babel/eslint-plugin": "^8.0.0",
"@babel/plugin-transform-nullish-coalescing-operator": "^8.0.1",
"@babel/plugin-transform-optional-chaining": "^8.0.1",
"@babel/preset-env": "^8.0.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Node/toolchain declarations found in repo =="
fd -HI '(^package\.json$|^\.nvmrc$|^\.node-version$|^\.tool-versions$)' | while read -r f; do
  echo "--- ${f}"
  sed -n '1,160p' "${f}"
done

echo
echo "== CI workflow Node settings =="
rg -n "setup-node|node-version|matrix" -g "*.yml" -g "*.yaml"

echo
echo "== Babel ESLint package engine constraints from lockfile =="
if fd -HI '^package-lock\.json$' >/dev/null; then
  rg -n -C3 '"node_modules/@babel/eslint-parser"|"node_modules/@babel/eslint-plugin"|"engines"|"node": "\\^22\\.18\\.0 \\|\\| >=24\\.11\\.0"' package-lock.json
else
  echo "No package-lock.json found."
fi

Repository: focus-trap/tabbable

Length of output: 4194


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Looking for CI/workflow files =="
fd -HI '\.(yml|yaml)$' -p '.github' 2>/dev/null || echo "No .github workflows found"

echo
echo "== Node version declaration files =="
fd -HI '^(\.nvmrc|\.node-version|\.tool-versions)$'

echo
echo "== Checking package-lock.json for Babel ESLint package engines =="
if [ -f package-lock.json ]; then
  echo "--- `@babel/eslint-parser` engines ---"
  jq '.packages["node_modules/@babel/eslint-parser"] | {version, engines}' package-lock.json 2>/dev/null || rg -A 5 '"node_modules/@babel/eslint-parser"' package-lock.json | head -20
  
  echo
  echo "--- `@babel/eslint-plugin` engines ---"
  jq '.packages["node_modules/@babel/eslint-plugin"] | {version, engines}' package-lock.json 2>/dev/null || rg -A 5 '"node_modules/@babel/eslint-plugin"' package-lock.json | head -20
else
  echo "No package-lock.json found"
fi

echo
echo "== Current package.json engines (if any) =="
jq '.engines // "No engines field"' package.json

Repository: focus-trap/tabbable

Length of output: 583


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== CI workflow Node configuration =="
cat -n .github/workflows/ci.yml

echo
echo "== Release workflow Node configuration =="
cat -n .github/workflows/release.yml

Repository: focus-trap/tabbable

Length of output: 4435


Release workflow will fail with Babel 8 packages—Node 20 is incompatible.

The release job (.github/workflows/release.yml, line 35) pins Node to 20, but Babel 8 packages require ^22.18.0 || >=24.11.0. When release CI runs npm run test, the lint step will fail before anything ships.

Additionally, package.json lacks an engines.node declaration. This means installs on Node <22 appear fine locally until CI blows up—a nasty surprise for contributors.

Fixes needed:

  1. Update release.yml to use Node 22 or latest (matching the test CI)
  2. Add "engines": { "node": "^22.18.0" } to package.json to prevent installs on incompatible versions

Note: The test CI already uses latest with check-latest: true, so main CI passes. But that's hiding the release job's incompatibility.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 55 - 60, The Babel 8 packages in package.json
require Node ^22.18.0 or >=24.11.0, but the release workflow in
.github/workflows/release.yml is pinned to Node 20, which will cause the release
CI to fail when running npm run test. To fix this, update the Node version in
the release.yml workflow to Node 22 or latest to match the test CI
configuration, and add an engines field to package.json specifying the required
Node version (e.g., "engines": { "node": "^22.18.0" }) to prevent incompatible
installations and alert contributors early.

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