[eslint-miner] feat(eslint): add no-core-exportvariable-non-string rule#45075
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[eslint-miner] feat(eslint): add no-core-exportvariable-non-string rule#45075github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Add a new ESLint rule that flags non-string values passed to core.exportVariable() — numbers, booleans, null, undefined, or .length — that silently produce unexpected strings (e.g. 'null', 'true') when the exported env var is read by downstream steps. This mirrors the existing no-core-setoutput-non-string rule and closes a preventive gap: all current exportVariable calls in actions/setup/js already use strings, but the rule guards against future regressions and matches the codebase convention. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ESLint Miner —
no-core-exportvariable-non-stringRule summary
New ESLint rule that flags non-string values passed to
core.exportVariable(): numeric literals, boolean literals,null,undefined, and.lengthmember accesses.Rationale
core.exportVariable(name, value)from@actions/coreserialises the value into the environment file ($GITHUB_ENV). Whenvalueis not a string, implicit coercion silently produces unexpected strings that downstream steps may mis-interpret:$GITHUB_ENVnull"null"true"true"42"42"items.length"0"This mirrors the existing
no-core-setoutput-non-stringrule (same logic, same targeted forms) and closes a preventive gap.Evidence from codebase scan
core.exportVariablecalls inactions/setup/jsalready use string values — the rule adds 0 new warnings at baseline.core.setOutputside (covered by the sibling rule) and the risk of copy-paste errors introducing non-string values is non-trivial.Changes
eslint-factory/src/rules/no-core-exportvariable-non-string.tseslint-factory/src/rules/no-core-exportvariable-non-string.test.tseslint-factory/src/index.tseslint-factory/eslint.config.cjswarnforactions/setup/jsValidation
Rule quality bar
actions/setup/js(exportVariable pattern)eslint-factoryandactions/setup/js(indirectly via lint)