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
Draft
fix: resolve JavaScript lint failures in CI (no-new-array, n/no-unsupported-features, no-buffer-constructor)#11882Planeshifter wants to merge 2 commits intodevelopfrom
Planeshifter wants to merge 2 commits intodevelopfrom
Conversation
- 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
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:
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! |
Contributor
Coverage Report
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
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.
Summary
Fixes two of three persistent JavaScript lint failures identified in CI issue #11867:
@stdlib/ndarray/fancytest (stdlib/no-new-array): Replacenew Array(shape.length)with[]+pushintest.instance.get_nd.js. ThebadValuehelper is semantically equivalent — both produce an array ofshape.lengthelements in the same order.@stdlib/symbol/async-iterator(n/no-unsupported-features/es-builtins): Addvar Symbol = require('@stdlib/symbol/ctor');to shadow the globalSymbol. Theeslint-plugin-nrule only flags the globalSymbol.asyncIterator(requires Node ≥ 10); a local binding namedSymbolresolves 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-constructorin@stdlib/utils/constructor-name/examples/index.js— was reverted from this PR. Removing that disable directive triggers a pre-existingstdlib/doctestfailure caused by theRE_ANNOTATIONregex greedily spanning thefunction 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
@stdlib/symbol/async-iteratorexports the correctSymbol.asyncIteratorsymbol in Node ≥ 10 environments andnullin older environments@stdlib/ndarray/fancyget-nd tests still throwTypeErrorfor out-of-bounds indicesNotes
ndarray/fancytest fix). This PR completes both.symbol/iteratorsibling still uses the bare globalSymbol.iterator(predates this pattern); that is out of scope.Contributing Guidelines
https://claude.ai/code/session_01SUwbJqiL1Fu619Hgnkt78N