chore: resolve JavaScript lint errors in utils/copy#11083
chore: resolve JavaScript lint errors in utils/copy#11083kgryte merged 1 commit intostdlib-js:developfrom
utils/copy#11083Conversation
Add eslint-disable-line comments for stdlib/no-new-array rule in @stdlib/utils/copy where new Array(length) is intentionally used to preserve sparse array length during deep copy operations. Resolves stdlib-js#11082
|
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! |
utils/copy
|
As the CI failure is not due to changes introduced in this PR, I'll go ahead and merge. |
Coverage ReportNo coverage information available. |
Summary
Fixes #11082
Resolves the
stdlib/no-new-arraylint error in the deep copy module by adding targeted eslint-disable-line comments wherenew Array(length)is intentionally required for sparse array preservation.Changes
lib/node_modules/@stdlib/utils/copy/lib/deep_copy.js(line 265): Added// eslint-disable-line stdlib/no-new-arraylib/node_modules/@stdlib/utils/copy/lib/main.js(line 70): Added// eslint-disable-line stdlib/no-new-arrayRationale
new Array(x.length)cannot be replaced with[]because sparse array copies must preserve the.lengthproperty. The test suite explicitly verifiesactual.length === 100for sparse arrays. This pattern follows existing project precedent (e.g.,@stdlib/stats/kstest/lib/main.js).Test plan
ESLint passes on both modified files
Deep copy functionality verified: sparse arrays, nested arrays, standard objects all copy correctly
Read, understood, and followed the contributing guidelines