Skip to content

Commit 8374349

Browse files
committed
fix: fall back to deprecated getSourceCode(); fixes #1159
1 parent e8b1475 commit 8374349

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/iterateJsdoc.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,10 @@ const getUtils = (
694694
indent,
695695
) => {
696696
const ancestors = /** @type {import('eslint').Rule.Node[]} */ (context.getAncestors());
697+
698+
// istanbul ignore next -- Fallback to deprecated method
697699
const {
698-
sourceCode,
700+
sourceCode = context.getSourceCode(),
699701
} = context;
700702

701703
const utils = /** @type {Utils} */ (getBasicUtils(context, settings));
@@ -2149,8 +2151,9 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveCommentContext
21492151
* @returns {void}
21502152
*/
21512153
const callIterator = (context, node, jsdocNodes, state, lastCall) => {
2154+
// istanbul ignore next -- Fallback to deprecated method
21522155
const {
2153-
sourceCode,
2156+
sourceCode = context.getSourceCode(),
21542157
} = context;
21552158
const {
21562159
lines,
@@ -2262,8 +2265,9 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveCommentContext
22622265
return {
22632266
// @ts-expect-error ESLint accepts
22642267
create (context) {
2268+
// istanbul ignore next -- Fallback to deprecated method
22652269
const {
2266-
sourceCode,
2270+
sourceCode = context.getSourceCode(),
22672271
} = context;
22682272
settings = getSettings(context);
22692273
if (!settings) {
@@ -2340,8 +2344,9 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveCommentContext
23402344
const checkFile = (iterator, ruleConfig) => {
23412345
return {
23422346
create (context) {
2347+
// istanbul ignore next -- Fallback to deprecated method
23432348
const {
2344-
sourceCode,
2349+
sourceCode = context.getSourceCode(),
23452350
} = context;
23462351
const settings = getSettings(context);
23472352
if (!settings) {
@@ -2459,8 +2464,9 @@ export default function iterateJsdoc (iterator, ruleConfig) {
24592464
}
24602465
}
24612466

2467+
// istanbul ignore next -- Fallback to deprecated method
24622468
const {
2463-
sourceCode,
2469+
sourceCode = context.getSourceCode(),
24642470
} = context;
24652471
const {
24662472
lines,

src/rules/requireJsdoc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ const getOptions = (context, settings) => {
288288
/** @type {import('eslint').Rule.RuleModule} */
289289
export default {
290290
create (context) {
291+
// istanbul ignore next -- Fallback to deprecated method
291292
const {
292-
sourceCode,
293+
sourceCode = context.getSourceCode(),
293294
} = context;
294295
const settings = getSettings(context);
295296
if (!settings) {

src/rules/requireReturns.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ export default iterateJsdoc(({
104104
initModuleExports: Boolean(publicOnly?.cjs ?? true),
105105
initWindow: Boolean(publicOnly?.window ?? false),
106106
};
107+
// istanbul ignore next -- Fallback to deprecated method
107108
const {
108-
sourceCode,
109+
sourceCode = context.getSourceCode(),
109110
} = context;
110111
const exported = exportParser.isUncommentedExport(
111112
/** @type {import('eslint').Rule.Node} */ (node), sourceCode, opt, settings,

0 commit comments

Comments
 (0)