Skip to content

Commit e9145c4

Browse files
committed
refactor(iterateJsdoc): reduce retrieval calls
1 parent 58518f5 commit e9145c4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/iterateJsdoc.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,11 @@ const iterateAllJsdocs = (iterator, ruleConfig) => {
351351
create (context) {
352352
return {
353353
'Program:exit' () {
354-
const comments = context.getSourceCode().getAllComments();
354+
const sourceCode = context.getSourceCode();
355+
const comments = sourceCode.getAllComments();
355356

356357
comments.forEach((comment) => {
357-
if (!context.getSourceCode().getText(comment).startsWith('/**')) {
358+
if (!sourceCode.getText(comment).startsWith('/**')) {
358359
return;
359360
}
360361

@@ -371,8 +372,8 @@ const iterateAllJsdocs = (iterator, ruleConfig) => {
371372
jsdocNode,
372373
node: null,
373374
report,
374-
settings: getSettings(context),
375-
sourceCode: context.getSourceCode(),
375+
settings,
376+
sourceCode,
376377
utils: getUtils(null, jsdoc, jsdocNode, settings, report, context)
377378
});
378379
});

0 commit comments

Comments
 (0)