fix(eslint-plugin-tsdoc): replace deprecated ESLint APIs for v10 compatibility#461
Merged
iclanton merged 1 commit intomicrosoft:mainfrom Feb 25, 2026
Merged
Conversation
…atibility Replace `context.getSourceCode()` with `context.sourceCode ?? context.getSourceCode()` and `context.getCwd?.()` with `context.cwd ?? context.getCwd?.()` to support ESLint 10 while maintaining backward compatibility with older versions. Fixes microsoft#455 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
@microsoft-github-policy-service agree |
iclanton
approved these changes
Feb 25, 2026
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
Replaces two deprecated ESLint
contextmethod calls with their modern property equivalents, fixing theTypeError: context.getSourceCode is not a functioncrash when usingeslint-plugin-tsdocwith ESLint 10.What changed
context.getCwd?.()context.cwd ?? context.getCwd?.()context.getSourceCode()context.sourceCode ?? context.getSourceCode()Why
context.getSourceCode()was deprecated in ESLint v8.40 and removed in ESLint v10.context.getCwd()was deprecated in ESLint v8.40 and removed in ESLint v10.??fallback pattern ensures backward compatibility with all ESLint versions the plugin currently supports.Reference: https://eslint.org/blog/2023/09/preparing-custom-rules-eslint-v9/
Fixes #455