Skip to content

build: unexport ESLINT_FLAGS to avoid collision with ESLint's feature-flag environment variable - #16370

Open
wanjinhao1 wants to merge 1 commit into
stdlib-js:developfrom
wanjinhao1:agent/fix-16368-eslint-flags-env-collision
Open

wanjinhao1 wants to merge 1 commit into
stdlib-js:developfrom
wanjinhao1:agent/fix-16368-eslint-flags-env-collision

Conversation

@wanjinhao1

@wanjinhao1 wanjinhao1 commented Oct 30, 2026 •

Copy link
Copy Markdown

Resolves #16368.

Description

What is the purpose of this pull request?

This pull request:

  • Adds unexport ESLINT_FLAGS to tools/make/lib/lint/javascript/eslint.mk so that the make variable ESLINT_FLAGS is not leaked into the environment of the invoked ESLint process.

Background: GNU make exports command-line variables as environment variables to recipes. Since ESLint 9.39+, the ESLINT_FLAGS environment variable is read to enable ESLint feature flags (e.g., unstable_native_nodejs_ts_config) and any unrecognized value throws Unknown flag '<value>'. Consequently, when the CI lint retry runs make lint-javascript-files ... ESLINT_FLAGS='--quiet' (see .github/workflows/scripts/common/lint_javascript_files_error_log), ESLint received ESLINT_FLAGS=--quiet in its environment, treated --quiet as a feature flag, and crashed with Error: Unknown flag '--quiet'. for every linted file — masking the actual lint results. Unexporting the variable keeps it as a pure make variable used only to build the ESLint command-line options (where --quiet is valid).

Reproduction (ESLint 9.39.5):

$ make check ESLINT_FLAGS=--quiet   # without this fix
Error: Unknown flag '--quiet'.
$ make check ESLINT_FLAGS=--quiet   # with `unexport ESLINT_FLAGS`
$ echo $?
0

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Reference Packages

Did the content of this pull request follow one or more existing packages? Answering is optional.

This pull request followed these packages:

  • none

What carried over from the reference(s)?

  • none

What differed, or what did you have to work out yourself?

  • Diagnosed the root cause by reproducing the collision between GNU make's command-line variable export behavior and ESLint 9.39+'s new ESLINT_FLAGS environment variable for feature flags.

Questions

Any questions for reviewers of this pull request?

No.


Verification: reproduced the failure locally with ESLint 9.39.5 using a minimal Makefile mirroring the eslint_flags pattern (make check ESLINT_FLAGS=--quiet fails with Error: Unknown flag '--quiet'. before the fix and passes after adding unexport ESLINT_FLAGS). Could not run the repository's full lint target locally without a full development-environment install; the change is limited to make variable export semantics.

This PR was prepared with AI assistance (agent operating on behalf of @wanjinhao1).

…arse it as feature flags

GNU make exports command-line variables as environment variables to
recipes. ESLint 9.39+ reads the ESLINT_FLAGS environment variable to
enable feature flags, so passing ESLINT_FLAGS='--quiet' on the make
command line (as the CI lint retry does) made ESLint fail with
"Unknown flag '--quiet'". Unexport the variable so it is only used to
build the ESLint command-line options.
@wanjinhao1
wanjinhao1 requested a review from a team October 30, 2026 01:15
@stdlib-bot stdlib-bot added the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Oct 30, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

Hello! Thank you for your contribution to stdlib.

We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do:

  1. Please read our contributing guidelines.

  2. Update your pull request description to include this checked box:

    - [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)

This acknowledgment confirms that you've read the guidelines, which include:

  • The developer's certificate of origin
  • Your agreement to license your contributions under the project's terms

We can't review or accept contributions without this acknowledgment.

Thank you for your understanding and cooperation. We look forward to reviewing your contribution!

@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Oct 30, 2026
@kgryte

kgryte commented Oct 30, 2026

Copy link
Copy Markdown
Member

I am not sure this is the right fix. If --quiet is not supported, maybe we should not be using the flag in the first place.

cc @Planeshifter

@Planeshifter Planeshifter left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kgryte, I believe this to be a good and correct fix for the regression.

--quiet option is still supported in ESLint. Problem arises because ESLint introduced reading a ESLINT_FLAGS environment variable in v9.27.0, released May 16, 2025, according to its release notes.

Before that, Make could export ESLINT_FLAGS=--quiet harmlessly because ESLint ignored the environment variable. But now it is interpreted as a feature flag and rejected: https://eslint.org/docs/latest/flags#enable-feature-flags-with-environment-variables.

Other options would be to rename our ESLINT_FLAGS variable to say ESLINT_CLI_FLAGS, which would be a breaking change, or to unset it each time when invoking ESLint. Both arguably worse than the solution offered in this PR.

@Planeshifter Planeshifter changed the title fix: unexport ESLINT_FLAGS to avoid collision with ESLint's feature-flag environment variable build: unexport ESLINT_FLAGS to avoid collision with ESLint's feature-flag environment variable Oct 30, 2026
@kgryte

kgryte commented Oct 30, 2026

Copy link
Copy Markdown
Member

@Planeshifter Except no other environment variable defined in our make recipes is accommodated like this.

While *_CLI_* also goes against convention, I am not sure I'd call it a "breaking change", as this is purely for developer usage, not downstream consumers.

@Planeshifter

Planeshifter commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

I did a search and looks like we only have four occurrences of ESLINT_FLAGS across 2 files:

  • .github/workflows/scripts/common/lint_javascript_files_error_log
  • tools/make/lib/lint/javascript/eslint.mk

I expected many more. So to make it cleaner, renaming instead to say ESLINT_CLI_FLAGS seems fine, too. And it would have the advantage of retaining ability of passing feature flags, should that ever be necessary, via ESLINT_FLAGS.

Granted, no breakage for end-users, but contributors will need to update Bash aliases, scripts, or shell functions that used the old variable name.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix JavaScript lint errors

4 participants