Skip to content

Commit cf62ec5

Browse files
committed
refactor(check-examples): avoid fixed constant in loop
1 parent 79c5c80 commit cf62ec5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rules/checkExamples.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import warnRemovedSettings from '../warnRemovedSettings';
55
const zeroBasedLineIndexAdjust = -1;
66
const likelyNestedJSDocIndentSpace = 1;
77
const preTagSpaceLength = 1;
8+
9+
// If a space is present, we should ignore it
10+
const firstLinePrefixLength = preTagSpaceLength;
11+
812
const hasCaptionRegex = /^\s*<caption>(.*?)<\/caption>/u;
913

1014
const escapeStringRegexp = (str) => {
@@ -116,9 +120,6 @@ export default iterateJsdoc(({
116120
}
117121

118122
utils.forEachPreferredTag('example', (tag, targetTagName) => {
119-
// If a space is present, we should ignore it
120-
const firstLinePrefixLength = preTagSpaceLength;
121-
122123
let source = tag.description;
123124
const match = source.match(hasCaptionRegex);
124125

0 commit comments

Comments
 (0)