aspect-build / aspect-build/rules_lint
ESLint 10: vendored stylish formatter still requires removed chalk dependency
- Dominant language
- Starlark
- Stars
- 154
- Forks
- 125
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 20
Description
### Reproduction
With `aspect_rules_lint` 2.7.2, `eslint` 10.8.0 and Node 22.23.1:
```starlark
eslint = lint_eslint_aspect(
binary = Label("//tools/lint:eslint"),
configs = [Label("//:eslint_config")],
rule_kinds = ["ts_project"],
)
```
Running the aspect fails before linting:
```text
There was a problem loading formatter: .../eslint.stylish-formatter.js
Error: Cannot find module 'chalk'
Require stack:
- .../eslint.stylish-formatter.js
```
ESLint 10 removed `chalk` from its dependencies and its built-in stylish formatter now uses `node:util.styleText`. The vendored formatter in rules_lint still calls `require.resolve("chalk", { paths: [eslintEntry...] })`, so a normal ESLint 10 install cannot satisfy it. The same implementation is present on `main` in `lint/js/eslint.stylish-formatter.cjs`.
### Current workaround
Declare `chalk@4` directly and add it to the Bazel ESLint binary runfiles. This makes the aspect start, but forces consumers to retain a dependency ESLint itself no longer needs.
### Suggested change
Update the vendored formatter for ESLint 10 / `node:util.styleText`, or otherwise avoid assuming that the user-installed ESLint carries `chalk`.
Contributor guide
Research direction
Start with lint/js/eslint.stylish-formatter.cjs and reproduce the failure using the lint_eslint_aspect configuration shown in the issue with ESLint 10. Check how the vendored formatter handles styling without assuming a user-installed chalk package. Done means the aspect starts and loads the stylish formatter with ESLint 10 without requiring chalk.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript, node.js
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100