Skip to content

Commit 93a53fd

Browse files
authored
Merge pull request #297 from golopot/patch-l
refactor: simplify curryUtils and rename it
2 parents 96ac40b + bb5c9bd commit 93a53fd

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/iterateJsdoc.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const parseComment = (commentNode, indent) => {
2222
})[0] || {};
2323
};
2424

25-
const curryUtils = (
25+
const getUtils = (
2626
node,
2727
jsdoc,
2828
{
@@ -37,10 +37,11 @@ const curryUtils = (
3737
allowAugmentsExtendsWithoutParam,
3838
checkSeesForNamepaths
3939
},
40-
ancestors,
41-
sourceCode,
4240
context
4341
) => {
42+
const ancestors = context.getAncestors();
43+
const sourceCode = context.getSourceCode();
44+
4445
const utils = {};
4546

4647
utils.getFunctionParameterNames = () => {
@@ -273,7 +274,7 @@ export {
273274
};
274275

275276
/**
276-
* @typedef {ReturnType<typeof curryUtils>} Utils
277+
* @typedef {ReturnType<typeof getUtils>} Utils
277278
* @typedef {ReturnType<typeof getSettings>} Settings
278279
*
279280
* @param {(arg: {utils: Utils, settings: Settings}) => any} iterator
@@ -320,8 +321,6 @@ export default function iterateJsdoc (iterator, ruleConfig) {
320321
return;
321322
}
322323

323-
const ancestors = context.getAncestors();
324-
325324
const indent = _.repeat(' ', jsdocNode.loc.start.column);
326325

327326
const jsdoc = parseComment(jsdocNode, indent);
@@ -353,12 +352,10 @@ export default function iterateJsdoc (iterator, ruleConfig) {
353352
});
354353
};
355354

356-
const utils = curryUtils(
355+
const utils = getUtils(
357356
node,
358357
jsdoc,
359358
settings,
360-
ancestors,
361-
sourceCode,
362359
context
363360
);
364361

0 commit comments

Comments
 (0)