Repository navigation
build: unexport ESLINT_FLAGS to avoid collision with ESLint's feature-flag environment variable - #16370
build: unexport ESLINT_FLAGS to avoid collision with ESLint's feature-flag environment variable#16370wanjinhao1 wants to merge 1 commit into
Conversation
…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.
|
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:
This acknowledgment confirms that you've read the guidelines, which include:
We can't review or accept contributions without this acknowledgment. Thank you for your understanding and cooperation. We look forward to reviewing your contribution! |
|
I am not sure this is the right fix. If |
There was a problem hiding this comment.
@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 Except no other environment variable defined in our make recipes is accommodated like this. While |
|
I did a search and looks like we only have four occurrences of ESLINT_FLAGS across 2 files:
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. |
Resolves #16368.
Description
This pull request:
unexport ESLINT_FLAGStotools/make/lib/lint/javascript/eslint.mkso that the make variableESLINT_FLAGSis 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_FLAGSenvironment variable is read to enable ESLint feature flags (e.g.,unstable_native_nodejs_ts_config) and any unrecognized value throwsUnknown flag '<value>'. Consequently, when the CI lint retry runsmake lint-javascript-files ... ESLINT_FLAGS='--quiet'(see.github/workflows/scripts/common/lint_javascript_files_error_log), ESLint receivedESLINT_FLAGS=--quietin its environment, treated--quietas a feature flag, and crashed withError: 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--quietis valid).Reproduction (ESLint 9.39.5):
Related Issues
This pull request has the following related issues:
Reference Packages
This pull request followed these packages:
ESLINT_FLAGSenvironment variable for feature flags.Questions
No.
Verification: reproduced the failure locally with ESLint 9.39.5 using a minimal Makefile mirroring the
eslint_flagspattern (make check ESLINT_FLAGS=--quietfails withError: Unknown flag '--quiet'.before the fix and passes after addingunexport 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).