Skip to content

chore: resolve JavaScript lint errors in utils/copy#11083

Merged
kgryte merged 1 commit intostdlib-js:developfrom
cskwork:fix/issue-11082-lint-errors
Mar 23, 2026
Merged

chore: resolve JavaScript lint errors in utils/copy#11083
kgryte merged 1 commit intostdlib-js:developfrom
cskwork:fix/issue-11082-lint-errors

Conversation

@cskwork
Copy link
Contributor

@cskwork cskwork commented Mar 22, 2026

Summary

Fixes #11082

Resolves the stdlib/no-new-array lint error in the deep copy module by adding targeted eslint-disable-line comments where new 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-array
  • lib/node_modules/@stdlib/utils/copy/lib/main.js (line 70): Added // eslint-disable-line stdlib/no-new-array

Rationale

new Array(x.length) cannot be replaced with [] because sparse array copies must preserve the .length property. The test suite explicitly verifies actual.length === 100 for 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

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
@stdlib-bot stdlib-bot added First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Mar 22, 2026
@stdlib-bot
Copy link
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 Mar 22, 2026
@github-actions github-actions bot mentioned this pull request Mar 22, 2026
@stdlib-bot stdlib-bot added the Potential Duplicate There might be another pull request resolving the same issue. label Mar 23, 2026
@kgryte kgryte added difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. review: 5 and removed Needs Review A pull request which needs code review. labels Mar 23, 2026
@kgryte kgryte changed the title fix: resolve JavaScript lint errors in utils/copy module chore: resolve JavaScript lint errors in utils/copy Mar 23, 2026
@kgryte
Copy link
Member

kgryte commented Mar 23, 2026

As the CI failure is not due to changes introduced in this PR, I'll go ahead and merge.

@stdlib-bot
Copy link
Contributor

Coverage Report

No coverage information available.

@kgryte kgryte merged commit e5b8da9 into stdlib-js:develop Mar 23, 2026
124 of 126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. Potential Duplicate There might be another pull request resolving the same issue. review: 5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix JavaScript lint errors

3 participants