Skip to content

fix: resolve JavaScript lint failures in CI (no-new-array, n/no-unsupported-features, no-buffer-constructor)#11882

Draft
Planeshifter wants to merge 2 commits intodevelopfrom
claude/blissful-heisenberg-FGUUP
Draft

fix: resolve JavaScript lint failures in CI (no-new-array, n/no-unsupported-features, no-buffer-constructor)#11882
Planeshifter wants to merge 2 commits intodevelopfrom
claude/blissful-heisenberg-FGUUP

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter commented May 1, 2026

Summary

Fixes two of three persistent JavaScript lint failures identified in CI issue #11867:

  • @stdlib/ndarray/fancy test (stdlib/no-new-array): Replace new Array(shape.length) with [] + push in test.instance.get_nd.js. The badValue helper is semantically equivalent — both produce an array of shape.length elements in the same order.

  • @stdlib/symbol/async-iterator (n/no-unsupported-features/es-builtins): Add var Symbol = require('@stdlib/symbol/ctor'); to shadow the global Symbol. The eslint-plugin-n rule only flags the global Symbol.asyncIterator (requires Node ≥ 10); a local binding named Symbol resolves the rule without changing runtime behavior. This matches the established pattern in @stdlib/symbol/to-primitive.

Not fixed here

The third error — stale // eslint-disable-line no-buffer-constructor in @stdlib/utils/constructor-name/examples/index.js — was reverted from this PR. Removing that disable directive triggers a pre-existing stdlib/doctest failure caused by the RE_ANNOTATION regex greedily spanning the function noop() {} block (which contains no ; character). That issue requires a separate fix (either adding a ; inside noop's body to break the greedy match, or fixing the regex in the doctest rule). It will be addressed in a follow-up.

Test plan

  • Verify CI JavaScript lint job passes on this branch
  • Confirm @stdlib/symbol/async-iterator exports the correct Symbol.asyncIterator symbol in Node ≥ 10 environments and null in older environments
  • Confirm @stdlib/ndarray/fancy get-nd tests still throw TypeError for out-of-bounds indices

Notes

  • PR fix: resolve JavaScript lint errors (issue #11867) #11878 (by a contributor) addresses only one of these two errors (missing the ndarray/fancy test fix). This PR completes both.
  • The symbol/iterator sibling still uses the bare global Symbol.iterator (predates this pattern); that is out of scope.

Contributing Guidelines

https://claude.ai/code/session_01SUwbJqiL1Fu619Hgnkt78N

- Replace `new Array(n)` with `[]` + `push` in `@stdlib/ndarray/fancy` test to satisfy `stdlib/no-new-array`
- Shadow global `Symbol` with `require('@stdlib/symbol/ctor')` in `@stdlib/symbol/async-iterator` so `Symbol.asyncIterator` no longer triggers `n/no-unsupported-features/es-builtins` (pattern matches `@stdlib/symbol/to-primitive`)
- Remove stale `// eslint-disable-line no-buffer-constructor` directive from `@stdlib/utils/constructor-name` example (rule was removed from config)

Closes #11867

https://claude.ai/code/session_01SUwbJqiL1Fu619Hgnkt78N
@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 the Good First PR A pull request resolving a Good First Issue. label May 1, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

stdlib-bot commented May 1, 2026

Coverage Report

Package Statements Branches Functions Lines
ndarray/fancy $\color{green}152/152$
$\color{green}+0.00%$
$\color{green}9/9$
$\color{green}+0.00%$
$\color{green}1/1$
$\color{green}+0.00%$
$\color{green}152/152$
$\color{green}+0.00%$
symbol/async-iterator $\color{green}91/91$
$\color{green}+0.00%$
$\color{red}2/3$
$\color{green}+0.00%$
$\color{green}0/0$
$\color{green}+0.00%$
$\color{green}91/91$
$\color{green}+0.00%$

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

The no-buffer-constructor unused disable directive fix in this file
triggers a pre-existing stdlib/doctest rule failure caused by RE_ANNOTATION
greedily spanning the function noop() block. Fixing that requires additional
scope; will be addressed separately.

https://claude.ai/code/session_01SUwbJqiL1Fu619Hgnkt78N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants