Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Oct 26, 2021
1 parent 14d7832 commit b44d0ad
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 37 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"@babel/preset-env": "^7.15.8",
"@babel/register": "^7.15.3",
"@hkdobrev/run-if-changed": "^0.3.1",
"@typescript-eslint/parser": "^5.1.0",
"@typescript-eslint/parser": "^5.2.0",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-istanbul": "^6.1.1",
"chai": "^4.3.4",
"cross-env": "^7.0.3",
"eslint": "^8.1.0",
"eslint-config-canonical": "^30.1.0",
"eslint-config-canonical": "^32.1.0",
"gitdown": "^3.1.4",
"glob": "^7.2.0",
"husky": "^7.0.4",
"lint-staged": "^11.2.3",
"lint-staged": "^11.2.4",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"open-editor": "^3.0.0",
Expand Down
42 changes: 28 additions & 14 deletions src/iterateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ const getUtils = (
};

const getSettings = (context) => {
/* eslint-disable sort-keys-fix/sort-keys-fix */
/* eslint-disable canonical/sort-keys */
const settings = {
// All rules
ignorePrivate: Boolean(context.settings.jsdoc?.ignorePrivate),
Expand Down Expand Up @@ -665,7 +665,7 @@ const getSettings = (context) => {
mode: context.settings.jsdoc?.mode ??
(context.parserPath.includes('@typescript-eslint') ? 'typescript' : 'jsdoc'),
};
/* eslint-enable sort-keys-fix/sort-keys-fix */
/* eslint-enable canonical/sort-keys */

jsdocUtils.setTagStructure(settings.mode);
try {
Expand Down Expand Up @@ -831,7 +831,7 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveContexts) => {

const utils = getBasicUtils(context, settings);
jsdocNodes.forEach((jsdocNode) => {
if (!(/^\/\*\*\s/).test(sourceCode.getText(jsdocNode))) {
if (!(/^\/\*\*\s/u).test(sourceCode.getText(jsdocNode))) {
return;
}

Expand All @@ -850,10 +850,18 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveContexts) => {
lastIndex: idx,
selector: node?.type,
},
indent, jsdoc,
ruleConfig, context, lines, jsdocNode, node,
settings, sourceCode, iterator,
state, true,
indent,
jsdoc,
ruleConfig,
context,
lines,
jsdocNode,
node,
settings,
sourceCode,
iterator,
state,
true,
);
});

Expand All @@ -880,10 +888,18 @@ const iterateAllJsdocs = (iterator, ruleConfig, contexts, additiveContexts) => {
lastIndex,
selector: node?.type,
},
indent, jsdoc,
ruleConfig, context, lines, jsdocNode, node,
settings, sourceCode, iterator,
state, true,
indent,
jsdoc,
ruleConfig,
context,
lines,
jsdocNode,
node,
settings,
sourceCode,
iterator,
state,
true,
);
});
if (lastCall && ruleConfig.exit) {
Expand Down Expand Up @@ -1085,9 +1101,7 @@ export default function iterateJsdoc (iterator, ruleConfig) {
}

iterate(
info, indent, jsdoc,
ruleConfig, context, lines, jsdocNode, node,
settings, sourceCode, iterator, state,
info, indent, jsdoc, ruleConfig, context, lines, jsdocNode, node, settings, sourceCode, iterator, state,
);
};

Expand Down
1 change: 1 addition & 0 deletions src/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ const getJsdocTagsDeep = (jsdoc : Object, targetTagName : string) : Array<Object
return ret;
};

// eslint-disable-next-line @babel/new-cap
const modeWarnSettings = WarnSettings();

const getTagNamesForMode = (mode, context) => {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/checkExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default iterateJsdoc(({
if (!filename) {
const jsFileName = context.getFilename();
if (typeof jsFileName === 'string' && jsFileName.includes('.')) {
defaultFileName = jsFileName.replace(/\..*?$/, `.${ext}`);
defaultFileName = jsFileName.replace(/\..*?$/u, `.${ext}`);
} else {
defaultFileName = `dummy.${ext}`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/checkIndentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default iterateJsdoc(({
excludeTags = ['example'],
} = options;

const reg = new RegExp(/^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmu);
const reg = /^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmu;
const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));
const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;

Expand Down
9 changes: 5 additions & 4 deletions src/rules/checkParamNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,18 @@ export default iterateJsdoc(({
disableExtraPropertyReporting,
enableFixer,
functionParameterNames,
jsdoc, jsdocNode, utils, report,
jsdoc,
jsdocNode,
utils,
report,
);

if (isError || !checkDestructured) {
return;
}

validateParameterNamesDeep(
targetTagName, allowExtraTrailingParamDocs,
jsdocParameterNamesDeep,
jsdoc, report,
targetTagName, allowExtraTrailingParamDocs, jsdocParameterNamesDeep, jsdoc, report,
);
}, {
meta: {
Expand Down
7 changes: 4 additions & 3 deletions src/rules/checkPropertyNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,17 @@ export default iterateJsdoc(({
const isError = validatePropertyNames(
targetTagName,
enableFixer,
jsdoc, jsdocNode, utils,
jsdoc,
jsdocNode,
utils,
);

if (isError) {
return;
}

validatePropertyNamesDeep(
targetTagName, jsdocPropertyNamesDeep,
jsdoc, report,
targetTagName, jsdocPropertyNamesDeep, jsdoc, report,
);
}, {
iterateAllJsdocs: true,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/matchDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default iterateJsdoc(({
if (jsdoc.description) {
const {description} = utils.getDescription();
validateDescription(
description.replace(/\s+$/, ''),
description.replace(/\s+$/u, ''),
);
}

Expand Down
13 changes: 9 additions & 4 deletions src/rules/multilineBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export default iterateJsdoc(({

utils.reportJSDoc(
'Single line blocks are not permitted by your configuration.',
null, fixer, true,
null,
fixer,
true,
);

return;
Expand All @@ -56,7 +58,8 @@ export default iterateJsdoc(({
};
utils.reportJSDoc(
'Should have no text on the "0th" line (after the `/**`).',
null, fixer,
null,
fixer,
);

return;
Expand Down Expand Up @@ -93,7 +96,8 @@ export default iterateJsdoc(({
};
utils.reportJSDoc(
'Should have no text on the final line (before the `*/`).',
null, fixer,
null,
fixer,
);
}
};
Expand Down Expand Up @@ -198,7 +202,8 @@ export default iterateJsdoc(({
utils.reportJSDoc(
'Multiline jsdoc blocks are prohibited by ' +
'your configuration.',
null, fixer,
null,
fixer,
);

return;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/newlineAfterDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default iterateJsdoc(({
}

const {description, lastDescriptionLine} = utils.getDescription();
const descriptionEndsWithANewline = (/\n\r?$/).test(description);
const descriptionEndsWithANewline = (/\n\r?$/u).test(description);

if (always) {
if (!descriptionEndsWithANewline) {
Expand Down
4 changes: 2 additions & 2 deletions src/rules/noDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export default iterateJsdoc(({
if (noOptionalParamNames && tag.optional) {
utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {
utils.changeTag(tag, {
name: tag.name.replace(/([^=]*)(=.+)?/, '$1'),
name: tag.name.replace(/([^=]*)(=.+)?/u, '$1'),
});
});
} else if (tag.default) {
utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {
utils.changeTag(tag, {
name: tag.name.replace(/([^=]*)(=.+)?/, '[$1]'),
name: tag.name.replace(/([^=]*)(=.+)?/u, '[$1]'),
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/rules/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const extractSentences = (text, abbreviationsRegex) => {
const sentenceEndGrouping = /([.?!])(?:\s+|$)/u;

// eslint-disable-next-line unicorn/no-array-method-this-argument
const puncts = RegExtras(sentenceEndGrouping).map(txt, (punct) => {
const puncts = new RegExtras(sentenceEndGrouping).map(txt, (punct) => {
return punct;
});

Expand Down Expand Up @@ -164,7 +164,7 @@ export default iterateJsdoc(({

const abbreviationsRegex = abbreviations.length ?
new RegExp('\\b' + abbreviations.map((abbreviation) => {
return _.escapeRegExp(abbreviation.replace(/\.$/g, '') + '.');
return _.escapeRegExp(abbreviation.replace(/\.$/ug, '') + '.');
}).join('|') + '(?:$|\\s)', 'gu') :
'';

Expand Down
2 changes: 1 addition & 1 deletion test/rules/assertions/checkTagNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const buildTagBlock = (tags) => {
};

const lineCount = (code) => {
return code.match(/\n/g).length;
return code.match(/\n/ug).length;
};

// We avoid testing all closure tags as too many
Expand Down

0 comments on commit b44d0ad

Please sign in to comment.