Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "eslint-plugin-tsdoc",
"comment": "Replace deprecated `context.getSourceCode()` and `context.getCwd()` with `context.sourceCode` and `context.cwd` for ESLint 10 compatibility, with fallback for older versions.",
"type": "patch"
}
],
"packageName": "eslint-plugin-tsdoc"
}
4 changes: 2 additions & 2 deletions eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function getRootDirectoryFromContext(context: TSESLint.RuleContext<string, unkno

// Fall back to the parserOptions.tsconfigRootDir if available, otherwise the eslint working directory
if (!rootDirectory) {
rootDirectory = context.parserOptions?.tsconfigRootDir ?? context.getCwd?.();
rootDirectory = context.parserOptions?.tsconfigRootDir ?? context.cwd ?? context.getCwd?.();
}

return rootDirectory;
Expand Down Expand Up @@ -109,7 +109,7 @@ const plugin: IPlugin = {

const tsdocParser: TSDocParser = new TSDocParser(tsdocConfiguration);

const sourceCode: eslint.SourceCode = context.getSourceCode();
const sourceCode: eslint.SourceCode = context.sourceCode ?? context.getSourceCode();
function checkCommentBlocks(): void {
for (const comment of sourceCode.getAllComments()) {
if (comment.type !== 'Block') {
Expand Down