Skip to content

build(deps): bump dependencies and migrate to ESLint 10 flat config#544

Merged
Strum355 merged 1 commit into
guacsec:mainfrom
Strum355:nsantsch/bump-deps-close-542
Jun 2, 2026
Merged

build(deps): bump dependencies and migrate to ESLint 10 flat config#544
Strum355 merged 1 commit into
guacsec:mainfrom
Strum355:nsantsch/bump-deps-close-542

Conversation

@Strum355

@Strum355 Strum355 commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Bump all safe dependencies to latest major versions (chai 4→6, mocha 10→11, sinon 15→22, eslint 8→10, typescript 5→6, and more)
  • Migrate ESLint to flat config (eslint.config.js) as required by ESLint 10
  • Replace eslint-plugin-import with eslint-plugin-import-x (ESLint 10 compatible)
  • Replace eslint-plugin-editorconfig with equivalent built-in ESLint rules (plugin uses removed API)
  • Fix Mocha 11 breaking change: convert all suite().beforeAll().afterAll() chains to suiteSetup()/suiteTeardown() inside suite callbacks
  • Add dependabot ignore for packageurl-js (blocked on upstream purl spec issue)

Supersedes #542 — bumps the same deps minus packageurl-js, and includes the ESLint 10 migration that was blocking the Dependabot PR.

Verification

  • npm run lint produces identical output (26 errors, 33 warnings — all pre-existing)
  • npm test produces identical results (406 passing, 35 failing — all pre-existing env-dependent failures from missing tools)

Test plan

  • npm install succeeds
  • npm run lint output unchanged
  • npm test results unchanged
  • Lint config produces same warnings/errors as before

🤖 Generated with Claude Code

Summary by Sourcery

Upgrade linting and test tooling dependencies and migrate ESLint configuration to the new flat config format while adapting tests and automation to remain compatible.

Build:

  • Update npm dependencies and devDependencies to newer major versions, including ESLint 10, TypeScript 6, Mocha 11, Chai 6, Sinon 22, and related tooling.
  • Adjust lint scripts and ESLint configuration to use the new flat config (eslint.config.js) with import-x and built-in formatting rules replacing eslint-plugin-editorconfig and eslint-plugin-import.
  • Add Dependabot configuration to ignore packageurl-js updates pending an upstream spec fix.

Tests:

  • Update Mocha suites to use suiteSetup and suiteTeardown hooks instead of deprecated beforeAll/afterAll chains, ensuring clocks, globals, and environment variables are correctly initialized and cleaned up across provider tests.

@sourcery-ai

sourcery-ai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR upgrades key dependencies (Mocha, Chai, Sinon, ESLint, TypeScript, etc.), migrates ESLint to the new v10 flat config with import-x and built-in formatting rules, and updates tests to comply with Mocha 11’s suite lifecycle APIs while preserving existing lint/test behavior.

Flow diagram for ESLint 10 flat config migration

flowchart LR
  subgraph Before
    A[npm_script_lint<br/>eslint src test --ext js]
    B[.eslintrc.json]
    C[eslintIgnore in package.json]
    A --> B
    A --> C
  end

  subgraph After
    D[npm_script_lint<br/>eslint src test]
    E[eslint.config.js<br/>flat config]
    F[eslint-plugin-import-x<br/>built-in formatting rules]
    D --> E
    E --> F
  end

  B -. replaced_by .- E
  C -. moved_to .- E
Loading

File-Level Changes

Change Details Files
Migrate ESLint configuration from .eslintrc JSON to ESLint 10 flat config using import-x and built-in formatting rules.
  • Introduce eslint.config.js using @eslint/js recommended config, eslint-plugin-import-x, and globals for Node, Mocha, and ES2021.
  • Replace eslint-plugin-import and eslint-plugin-editorconfig usage with import-x recommended rules and equivalent core ESLint rules (eol-last, indent, linebreak-style, etc.).
  • Move ignore patterns from package.json eslintIgnore to flat config ignores, adding dist/** to the ignored paths.
  • Adjust npm scripts to drop the deprecated --ext flag and rely on flat config defaults for JS.
eslint.config.js
.eslintrc.json
package.json
package-lock.json
Upgrade runtime and dev dependencies to latest majors while preserving behavior.
  • Bump libraries like @cyclonedx/cyclonedx-library, https-proxy-agent, p-limit and others to newer major versions.
  • Upgrade test stack: chai 4→6, sinon 15→22, sinon-chai 3→4, mocha 10→11, TypeScript 5→6, eslint 8→10 with supporting packages (@eslint/js, globals, eslint-plugin-import-x).
  • Update @types/node and which to current compatible major versions.
  • Regenerate package-lock.json to reflect all dependency updates.
package.json
package-lock.json
Adapt Mocha tests to v11 by replacing beforeAll/afterAll suite chains with suiteSetup/suiteTeardown and tightening resource cleanup.
  • Replace suite(...).beforeAll(...).afterAll(...) chains with suiteSetup/suiteTeardown calls inside each suite callback for many provider tests (rust_cargo, python_pip, python_pyproject, java_maven, java_gradle*, javascript, golang_gomodules, oci_images).
  • Ensure fake timers via sinon.useFakeTimers are initialized and restored via suiteSetup/suiteTeardown rather than chained hooks.
  • Adjust tests that manipulate process.env and process.platform to clean up state in suiteTeardown instead of afterAll hooks.
  • Change console.log spying in exhort-backend-utils tests to use suiteSetup/suiteTeardown instead of beforeAll/afterAll and keep expectations unchanged.
test/providers/rust_cargo.test.js
test/providers/python_pip.test.js
test/providers/python_pyproject.test.js
test/providers/java_maven.test.js
test/providers/java_gradle_groovy.test.js
test/providers/java_gradle_kotlin.test.js
test/providers/javascript.test.js
test/providers/golang_gomodules.test.js
test/providers/oci_images.test.js
test/exhort-backend-utils.test.js
Configure Dependabot to ignore packageurl-js updates blocked by upstream spec issues. .github/dependabot.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="eslint.config.js" line_range="14-18" />
<code_context>
+		plugins: {
+			"import-x": importPlugin,
+		},
+		languageOptions: {
+			ecmaVersion: 2022,
+			sourceType: "module",
+			globals: {
+				...globals.node,
+				...globals.mocha,
+				...globals.es2021,
+			},
+		},
</code_context>
<issue_to_address>
**suggestion:** Align `ecmaVersion` and globals to the same ECMAScript year to avoid subtle mismatches.

`ecmaVersion` is set to 2022 but you’re including `globals.es2021`. While this works, it’s inconsistent and may be confusing once newer ES globals are used. Please either switch to `globals.es2022` (or match the year to `ecmaVersion`) or omit the explicit ES globals and rely only on the Node globals for your target runtime.

```suggestion
			globals: {
				...globals.node,
				...globals.mocha,
				...globals.es2022,
			},
```
</issue_to_address>

### Comment 2
<location path="test/providers/rust_cargo.test.js" line_range="75" />
<code_context>

 let clock
 suite('testing the golang-go-modules data provider', () => {
+	suiteSetup(() => clock = useFakeTimers(new Date('2023-08-07T00:00:00.000Z')));
+	suiteTeardown(() => clock.restore());
 	[
</code_context>
<issue_to_address>
**suggestion:** Consider extracting a shared helper for the repeated fake-timer suiteSetup/suiteTeardown patterns

This `suiteSetup`/`suiteTeardown` fake-timer pattern with a fixed date is repeated across this and other provider tests. To improve maintainability and avoid suites drifting (e.g. different dates or a missing `restore()`), consider a shared helper such as `withFixedClock('2023-08-07T00:00:00.000Z', () => { ... })` or `setupFixedClock()`/`teardownClock()` so changes to fake-timer behavior are centralized.

Suggested implementation:

```javascript
let clock;
const FIXED_CLOCK_DATE = '2023-08-07T00:00:00.000Z';

function setupFixedClock() {
	clock = useFakeTimers(new Date(FIXED_CLOCK_DATE));
}

function teardownClock() {
	clock.restore();
}

```

```javascript
suite('testing the rust-cargo data provider', () => {
	suiteSetup(setupFixedClock);
	suiteTeardown(teardownClock);

```

```javascript
suite('testing the rust-cargo single crate without ignore', () => {
	suiteSetup(setupFixedClock);

```

There are likely other suites in this file (and possibly sibling provider test files) that use the same `suiteSetup(() => clock = useFakeTimers(new Date('2023-08-07T00:00:00.000Z')));` / `suiteTeardown(() => clock.restore());` pattern. Those should also be updated to use `suiteSetup(setupFixedClock);` and `suiteTeardown(teardownClock);` so the fake-timer behavior remains consistent and centrally managed.
Additionally, if the "rust-cargo single crate without ignore" suite (or others) defines its own `suiteTeardown(() => clock.restore());` later in the file, that should be replaced with `suiteTeardown(teardownClock);` to keep teardown logic unified.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread eslint.config.js
Comment thread test/providers/rust_cargo.test.js
@Strum355
Strum355 force-pushed the nsantsch/bump-deps-close-542 branch 2 times, most recently from ffd0652 to 5956544 Compare June 2, 2026 14:51
ruromero
ruromero previously approved these changes Jun 2, 2026

@ruromero ruromero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Bump all safe dependencies to latest major versions:
- @cyclonedx/cyclonedx-library 6→10, https-proxy-agent 7→9, p-limit 4→7
- chai 4→6, mocha 10→11, sinon 15→22, sinon-chai 3→4
- eslint 8→10, typescript 5→6, which 5→7, @types/node 20→25

Migrate ESLint configuration:
- Convert .eslintrc.json to eslint.config.js (flat config, required by ESLint 10)
- Replace eslint-plugin-import with eslint-plugin-import-x (ESLint 10 support)
- Replace eslint-plugin-editorconfig with equivalent built-in ESLint rules
  (plugin uses removed context.getFilename API incompatible with ESLint 10)

Fix Mocha 11 breaking change:
- Convert all suite().beforeAll().afterAll() chains to use
  suiteSetup()/suiteTeardown() inside suite callbacks (chaining API removed)

Add dependabot ignore for packageurl-js (blocked on upstream purl spec
issue for '+' encoding in versions, see package-url/packageurl-js#90).

Closes guacsec#542

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Strum355
Strum355 force-pushed the nsantsch/bump-deps-close-542 branch from 5956544 to 3dbfd1c Compare June 2, 2026 15:09
@Strum355
Strum355 enabled auto-merge (squash) June 2, 2026 15:15
@Strum355
Strum355 merged commit d2edf6e into guacsec:main Jun 2, 2026
5 checks passed
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.

2 participants