Skip to content

build: migrate JSDoc linting off removed core rules (gh54 part III)#10965

Draft
Planeshifter wants to merge 5 commits intophilipp/gh54-eslint-plugin-nfrom
philipp/gh54-jsdoc-migration
Draft

build: migrate JSDoc linting off removed core rules (gh54 part III)#10965
Planeshifter wants to merge 5 commits intophilipp/gh54-eslint-plugin-nfrom
philipp/gh54-jsdoc-migration

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

@Planeshifter Planeshifter commented Mar 15, 2026

Progresses stdlib-js/metr-issue-tracker#54.

Description

What is the purpose of this pull request?

This pull request:

  • Replaces deprecated ESLint core rules require-jsdoc and valid-jsdoc (both removed in ESLint v9) with eslint-plugin-jsdoc equivalents
  • Migrates require-jsdocjsdoc/require-jsdoc with the same option schema.
  • Replaces valid-jsdoc with individual jsdoc/* rules: jsdoc/require-description, jsdoc/require-param-description, jsdoc/require-returns-type, jsdoc/require-returns-description, and jsdoc/check-tag-names.
  • Registers the jsdoc plugin in etc/eslint/plugins/index.js.
  • Updates override files that disable require-jsdoc for tests, benchmarks, examples, and markdown.

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.

Stacked on #10952. The valid-jsdoc prefer option (aliasing argparam, returnreturns, etc.) has no direct equivalent in eslint-plugin-jsdoc's check-tag-names rule. Since stdlib already uses the canonical tag names, this is dropped without behavioral impact.

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.


@stdlib-js/reviewers

Replace deprecated ESLint rule APIs with their modern equivalents
to prepare for the ESLint v9 migration (see [1][2]):

- `context.getSourceCode()` → `context.sourceCode` (100 files)
- `context.getScope()` → `sourceCode.getScope(node)` (4 files)

The `context.getSourceCode()` method was deprecated in ESLint v8.40.0
in favor of the `context.sourceCode` property. The `context.getScope()`
method was deprecated in ESLint v8.38.0 in favor of
`sourceCode.getScope(node)`, which takes an explicit node argument
rather than relying on implicit traversal state.

For `no-builtin-big-int`, the scope acquisition was moved from the
`create` function (which previously captured the global scope once)
into the `CallExpression` visitor, and `isImportedBigInt` was updated
to walk up the scope chain to find `BigInt` declarations in outer
scopes.

Also fixes pre-existing lint violations in touched files:
- Move `copyLocationInfo`, `locationInfo`, `checkComment`,
  `extractPackagePath`, `getAlias`, and `sortExpressions` from nested
  functions to module scope
- Replace `.toUpperCase()`, `.toLowerCase()`, `.trim()` with stdlib
  equivalents
- Fix variable declaration ordering

No other deprecated APIs (`context.getAncestors`,
`context.getDeclaredVariables`, `context.markVariableAsUsed`,
deprecated comment/token access patterns) were found in the codebase.
All rules with `context.options` already have proper `meta.schema`.

[1]: https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/
[2]: https://eslint.org/docs/latest/use/migrate-to-9.0.0

Ref: stdlib-js/metr-issue-tracker#54

---
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
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - 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
---
Fix 9 pre-existing test failures across custom ESLint rules to ensure
all 123 rule tests pass cleanly on ESLint v8:

Rule fixes:
- `doctest-marker`: replace `acorn-walk` with ESLint `sourceCode` APIs
  (`getTokenBefore`, `getNodeByRangeIndex`) to avoid deprecated
  `node.start`/`node.end` property access; add line-proximity check
  for orphaned annotation detection
- `jsdoc-require-throws-tags`: replace `node.start`/`node.end` with
  `node.range[0]`/`node.range[1]`
- `jsdoc-no-space-aligned-asterisks`: fix autofix regex replacement
  that incorrectly turned trailing whitespace into asterisks (use
  `$1` back-reference instead of literal `*`)

Test fixture fixes:
- `no-redeclare`: add `ecmaVersion: 2015` for `sourceType: 'module'`
  test case
- `namespace-index-order`: reorder fixture entries to match
  alphabetical package path order
- `require-last-path-relative`: match error message backtick quoting
- `jsdoc-ordered-list-marker-value`: expect 4 errors (not 3) for
  newer `remark-lint-ordered-list-marker-value`
- `jsdoc-doctest-marker`: remove undefined `stdlib/require-globals`
  from `eslint-disable-line` comments
- `doctest-marker`: remove undefined `stdlib/no-builtin-math` from
  `eslint-disable-line` comments
- `jsdoc-no-blockquote-without-marker`: use lazy continuation
  pattern and update error message for `remark-lint` v2

Ref: stdlib-js/metr-issue-tracker#54

---
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
    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 changed the title bench: migrate JSDoc linting off removed core rules build: migrate JSDoc linting off removed core rules Mar 15, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-jsdoc-migration branch 2 times, most recently from c22d878 to e0e5a99 Compare March 15, 2026 14:16
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch from b0829cc to ac2468f Compare March 15, 2026 15:33
@Planeshifter Planeshifter force-pushed the philipp/gh54-jsdoc-migration branch from e0e5a99 to 0201b91 Compare March 15, 2026 15:33
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch from ac2468f to ff1e4ba Compare March 15, 2026 16:25
@Planeshifter Planeshifter force-pushed the philipp/gh54-jsdoc-migration branch from 0201b91 to b0f5533 Compare March 15, 2026 16:25
@Planeshifter Planeshifter changed the title build: migrate JSDoc linting off removed core rules build: migrate JSDoc linting off removed core rules (gh54 part III) Mar 15, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch from ff1e4ba to 4fbfcbf Compare March 15, 2026 17:01
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch from 4fbfcbf to 7f06a75 Compare March 15, 2026 17:38
Replace deprecated ESLint core rules `require-jsdoc` and `valid-jsdoc`
(removed in ESLint v9) with `eslint-plugin-jsdoc` equivalents:

- `require-jsdoc` → `jsdoc/require-jsdoc` (same option schema)
- `valid-jsdoc` → individual `jsdoc/*` rules:
  - `jsdoc/require-description` (replaces `matchDescription`)
  - `jsdoc/require-param-description` (replaces `requireParamDescription`)
  - `jsdoc/require-returns-type` (replaces `requireReturnType`)
  - `jsdoc/require-returns-description` (replaces `requireReturnDescription`)
  - `jsdoc/check-tag-names` (validates tag names)
- Register `jsdoc` plugin in `etc/eslint/plugins/index.js`
- Update override files that disable `require-jsdoc` for tests,
  benchmarks, examples, and markdown

Ref: stdlib-js/metr-issue-tracker#54
Audit and update `etc/eslint/rules/typescript.js` to prepare for
the typescript-eslint v7+ upgrade:

- Replace `@typescript-eslint/no-var-requires` (deprecated, removed
  in v7) with `@typescript-eslint/no-require-imports` (same behavior,
  already defined but was `off`)
- Formatting/layout rules (`indent`, `quotes`, `semi`,
  `member-delimiter-style`, `space-before-function-paren`,
  `type-annotation-spacing`) are deprecated in v6 in favor of
  `@stylistic/ts/*` but kept for now since they still work on v6;
  will be addressed during the toolchain version bump (PR 6)
- `ban-types` and `no-empty-interface` are not yet deprecated on v6
  but will need replacement in v7+ (`no-restricted-types` and
  `no-empty-object-type` respectively)

Ref: stdlib-js/metr-issue-tracker#54
@Planeshifter Planeshifter force-pushed the philipp/gh54-jsdoc-migration branch from b0f5533 to 28cbc14 Compare March 15, 2026 17:46
@Planeshifter Planeshifter added the METR Pull request associated with the METR project. label Mar 18, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch from 7f06a75 to dd197bb Compare March 23, 2026 04:20
@stdlib-bot stdlib-bot added the Merge Conflicts Pull request which has merge conflicts. label Mar 23, 2026
@github-actions github-actions bot mentioned this pull request Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge Conflicts Pull request which has merge conflicts. METR Pull request associated with the METR project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants