Skip to content

Commit

Permalink
refactor(iterateJsdoc): reduce retrieval calls
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jul 13, 2019
1 parent 58518f5 commit e9145c4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/iterateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,11 @@ const iterateAllJsdocs = (iterator, ruleConfig) => {
create (context) {
return {
'Program:exit' () {
const comments = context.getSourceCode().getAllComments();
const sourceCode = context.getSourceCode();
const comments = sourceCode.getAllComments();

comments.forEach((comment) => {
if (!context.getSourceCode().getText(comment).startsWith('/**')) {
if (!sourceCode.getText(comment).startsWith('/**')) {
return;
}

Expand All @@ -371,8 +372,8 @@ const iterateAllJsdocs = (iterator, ruleConfig) => {
jsdocNode,
node: null,
report,
settings: getSettings(context),
sourceCode: context.getSourceCode(),
settings,
sourceCode,
utils: getUtils(null, jsdoc, jsdocNode, settings, report, context)
});
});
Expand Down

0 comments on commit e9145c4

Please sign in to comment.