Skip to content

Comments

refactor(cli): replace glob with tinyglobby and remediate dependency audit chains#2414

Open
ignatremizov wants to merge 2 commits intobeautifier:mainfrom
ignatremizov:deps-tinyglobby-editorconfig-audit-fixes
Open

refactor(cli): replace glob with tinyglobby and remediate dependency audit chains#2414
ignatremizov wants to merge 2 commits intobeautifier:mainfrom
ignatremizov:deps-tinyglobby-editorconfig-audit-fixes

Conversation

@ignatremizov
Copy link

@ignatremizov ignatremizov commented Feb 21, 2026

Description

  • Source branch in your fork has meaningful name (not main)

This PR modernizes dependency usage to remove the vulnerable production glob/minimatch path and fully clean up npm audit findings.

Main changes:

  • replace direct CLI usage of glob with tinyglobby in js/src/cli.js
  • bump editorconfig to ^3.0.1 and raise Node engine floor to >=20
  • add targeted dependency overrides to remediate vulnerable transitive packages
  • update dev tooling versions (mocha, serve, webpack)
  • add tools/jshint-runner.js compatibility shim so existing jshint flow continues working with modern minimatch exports

Size impact:

  • Runtime globbing dependency package: glob@10.5.0 = 482,422 bytes vs tinyglobby@0.2.15 = 40,175 bytes (~91.7% smaller, ~12x)
  • Published js-beautify npm package size (npm pack --dry-run) is effectively unchanged:
    • tarball: 64,095 bytes -> 64,241 bytes (+146 bytes)
    • unpacked: 293,130 bytes -> 293,535 bytes (+405 bytes)
  • Overall production install footprint (npm ci --omit=dev in clean worktrees):
    • node_modules: 6,128 KB -> 1,776 KB (~71.0% smaller)

Fixes Issue: #2386

Related PRs:

Before Merge Checklist

These items can be completed after PR is created.

(Check any items that are not applicable (NA) for this PR)

  • JavaScript implementation
  • Python implementation (NA if HTML beautifier)
  • Added Tests to data file(s)
  • Added command-line option(s) (NA if
  • README.md documents new feature/option(s)

…g deps

Replace CLI glob matching with `tinyglobby` and bump EditorConfig/Node runtime requirements to reduce production dependency weight and clear the previous production minimatch vulnerability chain.

Changes:
- switch CLI file-glob detection and expansion from `glob` to `tinyglobby` (`isDynamicPattern` + `globSync`)
- preserve prior CLI behavior by keeping absolute paths, ignore rules, and directory-inclusive matching
- bump `editorconfig` to `^3.0.1`
- raise `engines.node` to `>=20` to match modern EditorConfig requirements
- add override so EditorConfig resolves `minimatch` to `10.2.1`

Validation:
- `make js` passes
- EditorConfig CLI smoke path (`--editorconfig`) passes
- `npm audit --omit=dev` reports 0 vulnerabilities
…hain

Update dev dependencies and add targeted overrides so full `npm audit` is clean while preserving the existing build/test workflow.

Changes:
- bump dev tooling versions:
  - `mocha` to `^11.7.5`
  - `serve` to `^14.2.5`
  - `webpack` to `^5.105.2`
- add override pins for vulnerable transitive packages used by dev tooling:
  - `ajv@8.18.0`
  - `diff@8.0.3`
  - `glob@13.0.6`
  - `minimatch@10.2.1`
  - `brace-expansion@2.0.2`
  - `js-yaml@4.1.1`
  - `lodash@4.17.23`
  - `on-headers@1.1.0`
- keep `editorconfig` on modern stack and preserve its minimatch override
- add `tools/jshint-runner.js` compatibility loader so legacy jshint code paths continue to work with modern `minimatch` exports
- route lint execution through the compatibility runner in `tools/build.sh`

Validation:
- `npm audit` reports 0 vulnerabilities
- `make js` passes (lint, webpack build, mocha tests, node-src-index tests)
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