Skip to content

test: import Symbol constructor - #15241

Merged
kgryte merged 1 commit into
developfrom
philipp/ci-fix-lint-random-files-symbol-toprimitive-2026-09-15
Sep 16, 2026
Merged

kgryte merged 1 commit into
developfrom
philipp/ci-fix-lint-random-files-symbol-toprimitive-2026-09-15

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • Fixes a lint_random_files CI failure on develop: https://github.com/stdlib-js/stdlib/actions/runs/34911553402 (lint_random_files / "Lint JavaScript files").
  • ESLint (n/no-unsupported-features/es-builtins) flags lib/node_modules/@stdlib/symbol/to-primitive/test/test.js:50:22 for referencing the global Symbol.toPrimitive, unsupported under this repo's configured Node floor (>=0.12.18 in etc/eslint/rules/nodejs.js; Symbol.toPrimitive requires Node 6+).
  • The package's own lib/main.js already shadows the global via var Symbol = require( '@stdlib/symbol/ctor' );, so the rule's scope analysis doesn't flag it there. The test file never did the same, so the reference resolved to the global builtin and tripped the rule.
  • Adds the identical shadow to test/test.js. @stdlib/symbol/ctor re-exports the global Symbol constructor unchanged, so this is referentially identical at runtime — no behavior change, only satisfies lint. The same pattern is already used in 74 other test files across the repo, and in symbol/async-iterator/lib/main.js (fix: shadow global Symbol in async-iterator to resolve lint #11905, chore: resolve n/no-unsupported-features lint error in symbol/async-iterator #11927).
  • 1 file changed, 1 insertion.

Related Issues

Does this pull request have any related issues?

None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Confirmed the shadow resolves the flagged line by static analysis of the ESLint rule's scope-analysis behavior and by checking runtime referential identity (require('@stdlib/symbol/ctor') === global Symbol). tape is not installed in this environment, so the suite itself was not executed locally.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was authored by an automated CI-failure investigation and fix routine (Claude Code) running as a scheduled task. Three independent reviewer passes (correctness, regression scope, style/conventions) approved the change with no blocking findings before this PR was opened.


@stdlib-js/reviewers

🤖 Generated with Claude Code

https://claude.ai/code/session_01NcrBJtjFWieVFKStqCyyYH


Generated by Claude Code

…lint

The job "Lint JavaScript files" in workflow `lint_random_files` failed
on develop with an `n/no-unsupported-features/es-builtins` error on
`test/test.js:50`, flagging the bare reference to the global
`Symbol.toPrimitive` as unsupported under the repo's configured Node
version floor (`>=0.12.18`; `Symbol.toPrimitive` requires Node 6+).
Root cause: the test file never shadowed the global `Symbol`, unlike
this package's own `lib/main.js`, which already imports
`@stdlib/symbol/ctor` locally as `Symbol` for the same reason. This
commit adds the identical shadow to the test file. `@stdlib/symbol/ctor`
re-exports the global `Symbol` constructor unchanged, so the shadowed
reference is referentially identical at runtime and the lint rule's
scope analysis no longer treats it as a global-builtin reference,
resolving the failure without altering test behavior.

Ref: https://github.com/stdlib-js/stdlib/actions/runs/34911553402

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NcrBJtjFWieVFKStqCyyYH
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
symbol/to-primitive $\\color{green}120/120$
$\\color{green}+100.00\\%$
$\\color{red}2/3$
$\\color{green}+66.67\\%$
$\\color{green}0/0$
$\\color{green}+100.00\\%$
$\\color{green}120/120$
$\\color{green}+100.00\\%$

The above coverage report was generated for the changes in this PR.

@kgryte
kgryte marked this pull request as ready for review September 16, 2026 04:06
@kgryte
kgryte requested a review from a team September 16, 2026 04:06
@kgryte kgryte changed the title test(@stdlib/symbol/to-primitive): shadow global Symbol to resolve lint test: import Symbol constructor Sep 16, 2026
@kgryte
kgryte merged commit 515b943 into develop Sep 16, 2026
18 checks passed
@kgryte
kgryte deleted the philipp/ci-fix-lint-random-files-symbol-toprimitive-2026-09-15 branch September 16, 2026 04:07
@stdlib-bot stdlib-bot added Needs Review A pull request which needs code review. and removed Needs Review A pull request which needs code review. labels Sep 16, 2026
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.

4 participants