Skip to content

chore(deps): babel coverage, devDeps cleanup, eslint 10 flat config#15

Merged
JasonSooter merged 3 commits into
mainfrom
chore/coverage-deps-eslint9
Jul 7, 2026
Merged

chore(deps): babel coverage, devDeps cleanup, eslint 10 flat config#15
JasonSooter merged 3 commits into
mainfrom
chore/coverage-deps-eslint9

Conversation

@JasonSooter

Copy link
Copy Markdown
Contributor

Before this PR

  • jest.config.js used coverageProvider: 'v8' with no collectCoverageFrom and no threshold. v8 collapsed the optional-chaining export guard in src/index.js, reporting a false 100% while a branch was actually uncovered.
  • ESLint pinned to 8.57.1 (legacy .eslintrc.js, EOL, carrying transitive advisories), eslint-plugin-jest 27, lint-staged 16.
  • devDeps carried unused packages: eslint-config-prettier, eslint-plugin-prettier, eslint-formatter-table, prettier-eslint, node-fetch, semver. lodash was only present transitively (via prettier-eslint). setup.js injected unused crypto/cache globals; .eslintrc.js declared unused jsonwebtoken global.
  • wallaby.js duplicated the setup.js globals/coverage config by hand, free to drift from the Jest config.

After this PR

  • coverageProvider: 'babel' (honest branch coverage + Wallaby parity), collectCoverageFrom: ['src/**/*.js'], enforced 100% threshold. Added 1 test (module-exports guard, re-require with NODE_DEV unset) to close the newly-visible branch. Coverage 100% all metrics; 2 tests pass.
  • ESLint upgraded to ^10.6.0 with a flat eslint.config.js (node-only globals), eslint-plugin-jest ^29.15.4, added @eslint/js ^10.0.1 + globals ^17.7.0. Newly-enforced rules disabled to preserve prior behavior so npx eslint . passes with zero source changes. lint-staged bumped to ^17.0.8.
  • Unused devDeps removed; lodash pinned direct at 4.18.1 (Segment runtime global). moment-timezone ^0.5.31 left pinned. jest-fetch-mock kept.
  • wallaby.js reduced to autoDetect: ['jest'] (single source of truth = Jest config).
  • Lockfile hard-refreshed via Twilio Artifactory; npm audit 0 vulnerabilities.

Reason that prompted this change

  • This is the template the JPMC function fleet copies from, so it must carry the canonical babel-coverage + eslint-10-flat-config + cleaned-devDeps baseline. v8 coverage was masking an untested branch, and eslint 8 is EOL.

Test Plan

  • npx jest -> 100% statements/branches/functions/lines, 2 tests pass.
  • npx eslint . -> exit 0, zero code changes (no --fix churn).
  • npm audit -> 0 vulnerabilities.
  • Lockfile: all resolved hosts are npmjs.artifacts.twilio.com.
  • Pre-commit hook (lint-staged + npm test) exercised by the commit itself and passed.
  • No product code (src/index.js) modified; coverage closed via tests only.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 6, 2026 13:07

Copilot AI 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.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Updates the repo’s dev tooling baseline to use Babel/Istanbul coverage, ESLint 10 flat config, and a simplified Wallaby setup, while cleaning up devDependencies and tightening coverage enforcement.

Changes:

  • Switched Jest coverage to Babel with scoped collection + 100% global thresholds; added a test to cover the module export guard branch.
  • Migrated from legacy .eslintrc.js to ESLint 10 flat config with updated plugins/globals.
  • Simplified wallaby.js to auto-detect Jest and removed duplicated config.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wallaby.js Removes manual Wallaby config and relies on Jest auto-detection to prevent drift.
src/index.test.js Adds a Jest test to cover the module export guard behavior.
setup.js Removes unused globals and introduces a RetryError global for tests/lint parity.
package.json Updates linting toolchain deps and removes unused devDependencies; adds direct lodash pin.
jest.config.js Switches to Babel coverage provider, scopes coverage collection, and enforces 100% thresholds.
eslint.config.js Introduces ESLint 10 flat config with node globals + Jest-only overrides for tests.
.eslintrc.js Removes legacy ESLint configuration.

Comment thread src/index.test.js Outdated
Comment thread eslint.config.js
@JasonSooter JasonSooter added the !!_RELEASE_TO_QA Release Code Change to QA Environment label Jul 7, 2026
JasonSooter and others added 3 commits July 7, 2026 14:30
- switch jest coverageProvider v8 -> babel for honest branch coverage
  (v8 collapsed the optional-chaining export guard, hiding an uncovered
  path); scope coverage to src/ (exclude setup.js scaffolding); enforce
  100% threshold; add 1 test (module-exports guard) to reach 100% branches
- upgrade eslint 8.57.1 -> 10 (^10.6.0), eslint-plugin-jest 27 -> 29
  (^29.15.4), add @eslint/js ^10.0.1 + globals ^17.7.0; migrate
  .eslintrc.js -> flat eslint.config.js (node-only globals); disable newly
  enforced rules to preserve prior behavior (no source changes)
- bump lint-staged 16 -> 17 (^17.0.8; dev-only git-hook runner, Node >=22)
- remove unused devDeps: eslint-config-prettier, eslint-plugin-prettier,
  eslint-formatter-table, prettier-eslint, node-fetch, semver (+ crypto/
  cache/jsonwebtoken globals); pin lodash 4.18.1 direct (was transitive)
- wallaby.js: autoDetect jest instead of duplicating setup.js (fixes drift)
- hard-refresh lockfile via Artifactory; npm audit 0 vulnerabilities

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
package.json declares moment-timezone; requiring plain 'moment' relied on a
transitive dep. Aligns test setup with the declared dependency.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…obals

- NODE_DEV restore now uses try/finally and restores to the module-scope 'TEST'
  value (never assigns undefined).
- Remove unused eslint globals `cache` (not defined in setup.js) and `rules`
  (JPMC-specific function-bundling global, not part of the template).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JasonSooter JasonSooter force-pushed the chore/coverage-deps-eslint9 branch from 7c87c41 to ecbaff0 Compare July 7, 2026 12:30
@JasonSooter JasonSooter merged commit e31f532 into main Jul 7, 2026
12 checks passed
@JasonSooter JasonSooter deleted the chore/coverage-deps-eslint9 branch July 7, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!!_RELEASE_TO_QA Release Code Change to QA Environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants