Skip to content

build: avoid false positives in ESLint rule jsdoc-doctest-decimal-point - #14644

Merged
kgryte merged 4 commits into
developfrom
philipp/fix-jsdoc-doctest-decimal-point
Aug 27, 2026
Merged

build: avoid false positives in ESLint rule jsdoc-doctest-decimal-point#14644
kgryte merged 4 commits into
developfrom
philipp/fix-jsdoc-doctest-decimal-point

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Aug 26, 2026

Copy link
Copy Markdown
Member

Resolves https://github.com/stdlib-js/todo/issues/1517 and stdlib-js/metr-issue-tracker#1237.

Description

What is the purpose of this pull request?

This pull request:

  • fixes false positives in the jsdoc-doctest-decimal-point ESLint rule, which applied a documented function's @returns type to every annotation in every @example:

    • Mutation annotations: for a function documented as @returns {integer} (e.g., a LAPACK status code) which mutates a Float64Array argument, annotations such as // D => <Float64Array>[ 3.0, 5.0 ] were incorrectly flagged for containing decimal points (see, e.g., the incorrect diagnostic surfaced in the review of feat: add lapack/base/dlasrt #12354). Annotations of the form // <identifier> => ... describe mutated values, not return values, and are now skipped.
    • Non-scalar annotation values: annotation values which are not scalar numeric values (e.g., printed arrays such as // => <Float32Array>[ 1.0, 2.0 ]) do not have the documented return type and are no longer validated against it (previously only enforced in the "must include a decimal point" branch, but not in the "must NOT include a decimal point" branch).
    • Typed array element accessors: for a function documented as @returns {number} which returns elements of an integer typed array parameter (e.g., function getUint8( arr, idx ) { return arr[ idx ]; } with @param {Uint8Array} arr), annotations such as // returns 3 were incorrectly required to include a decimal point (see stdlib-js/todo#1517). The rule now resolves @param types and, when a function only ever returns elements of typed array parameters whose element type conflicts with the documented return type, skips validation, as the correct annotation format cannot be inferred from the return type alone. When the element type matches the documented return type, validation still applies.
  • adds test fixtures covering each of the above scenarios.

  • removes eslint-disable directives which are no longer needed under the fixed rule (in array/base/getter, the blas/base/wasm/* packages, and lapack/base/dgttrf); the directives in utils/type-max and utils/type-min remain, as those functions return integer-valued constants and are not covered by the accessor heuristic.

To validate beyond the unit tests, the previous and fixed rule were run over 5,538 source files across the array, blas, lapack, number, and strided namespaces: the previous rule reported 76 diagnostics (all false positives, each suppressed via an eslint-disable directive), while the fixed rule reports 0, with no new diagnostics introduced.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

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.

No.

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 written primarily by Claude Code under my direction, with the approach and validation reviewed by myself.


@stdlib-js/reviewers

…cimal-point`

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Aug 26, 2026
@stdlib-bot

stdlib-bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
array/base/getter $\\color{green}350/350$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}13/13$
$\\color{green}+0.00\\%$
$\\color{green}350/350$
$\\color{green}+0.00\\%$
blas/base/wasm/ccopy $\\color{green}672/672$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}672/672$
$\\color{green}+0.00\\%$
blas/base/wasm/cscal $\\color{green}694/694$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}694/694$
$\\color{green}+0.00\\%$
blas/base/wasm/csrot $\\color{green}706/706$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}706/706$
$\\color{green}+0.00\\%$
blas/base/wasm/cswap $\\color{green}695/695$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}695/695$
$\\color{green}+0.00\\%$
blas/base/wasm/daxpy $\\color{green}637/637$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}637/637$
$\\color{green}+0.00\\%$
blas/base/wasm/dcopy $\\color{green}633/633$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}633/633$
$\\color{green}+0.00\\%$
blas/base/wasm/drot $\\color{green}669/669$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}669/669$
$\\color{green}+0.00\\%$
blas/base/wasm/drotm $\\color{green}684/684$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}684/684$
$\\color{green}+0.00\\%$
blas/base/wasm/dscal $\\color{green}604/604$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}604/604$
$\\color{green}+0.00\\%$
blas/base/wasm/dswap $\\color{green}661/661$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}661/661$
$\\color{green}+0.00\\%$
blas/base/wasm/saxpy $\\color{green}637/637$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}637/637$
$\\color{green}+0.00\\%$
blas/base/wasm/scopy $\\color{green}633/633$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}633/633$
$\\color{green}+0.00\\%$
blas/base/wasm/srot $\\color{green}669/669$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}669/669$
$\\color{green}+0.00\\%$
blas/base/wasm/srotm $\\color{green}684/684$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}684/684$
$\\color{green}+0.00\\%$
blas/base/wasm/sscal $\\color{green}608/608$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}608/608$
$\\color{green}+0.00\\%$
blas/base/wasm/sswap $\\color{green}661/661$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}661/661$
$\\color{green}+0.00\\%$
blas/base/wasm/zcopy $\\color{green}673/673$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}673/673$
$\\color{green}+0.00\\%$
blas/base/wasm/zdrot $\\color{green}706/706$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}706/706$
$\\color{green}+0.00\\%$
blas/base/wasm/zscal $\\color{green}694/694$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}694/694$
$\\color{green}+0.00\\%$
blas/base/wasm/zswap $\\color{green}695/695$
$\\color{green}+0.00\\%$
$\\color{green}17/17$
$\\color{green}+0.00\\%$
$\\color{green}6/6$
$\\color{green}+0.00\\%$
$\\color{green}695/695$
$\\color{green}+0.00\\%$
lapack/base/dgttrf $\\color{green}459/459$
$\\color{green}+0.00\\%$
$\\color{green}29/29$
$\\color{green}+0.00\\%$
$\\color{green}3/3$
$\\color{green}+0.00\\%$
$\\color{green}459/459$
$\\color{green}+0.00\\%$

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

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown_pkg_readmes
    status: na
  - task: lint_markdown_docs
    status: na
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: passed
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: passed
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: na
  - task: lint_license_headers
    status: passed
---
@Planeshifter
Planeshifter marked this pull request as ready for review August 26, 2026 06:01
@Planeshifter
Planeshifter requested review from a team and kgryte August 26, 2026 06:02
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 26, 2026
@Planeshifter Planeshifter added the METR Pull request associated with the METR project. label Aug 26, 2026
Co-authored-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
@kgryte
kgryte merged commit 607bbc6 into develop Aug 27, 2026
11 checks passed
@kgryte
kgryte deleted the philipp/fix-jsdoc-doctest-decimal-point branch August 27, 2026 11:05
@stdlib-bot stdlib-bot removed the Needs Review A pull request which needs code review. label Aug 27, 2026
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. METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants