Skip to content

Commit

Permalink
fix: apply style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Oct 26, 2021
1 parent 9f29610 commit a876af8
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"import/extensions": 0,
"prefer-named-capture-group": 0,
"unicorn/no-array-reduce": 0,
"unicorn/no-unsafe-regex": 0,
"unicorn/prefer-array-some": 0,
"unicorn/prevent-abbreviations": 0
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"chai": "^4.3.4",
"cross-env": "^7.0.3",
"eslint": "^8.1.0",
"eslint-config-canonical": "^32.10.0",
"eslint-config-canonical": "^32.12.1",
"gitdown": "^3.1.4",
"glob": "^7.2.0",
"husky": "^7.0.4",
Expand Down
4 changes: 3 additions & 1 deletion src/exportParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ const isUncommentedExport = function (node, sourceCode, opt, settings) {
return true;
}

/** Some typescript types are not in variable map, but inherit exported (interface property and method)*/
/**
* Some typescript types are not in variable map, but inherit exported (interface property and method)
*/
if (
isExportByAncestor(node) &&
!findJSDocComment(node, sourceCode, settings)
Expand Down
7 changes: 6 additions & 1 deletion src/iterateJsdoc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
/* eslint-disable jsdoc/valid-types */

import {
getReducedASTNode, getJSDocComment, commentHandler, parseComment,
getReducedASTNode,
getJSDocComment,
commentHandler,
parseComment,
} from '@es-joy/jsdoccomment';
import {
stringify as commentStringify,
Expand Down
6 changes: 5 additions & 1 deletion src/jsdocUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable jsdoc/no-undefined-types */

import _ from 'lodash';
import WarnSettings from './WarnSettings';
import getDefaultTagStructureForMode from './getDefaultTagStructureForMode';
Expand Down Expand Up @@ -1095,7 +1097,9 @@ const hasThrowValue = (node, innerFunction) => {
}
};

/** @param {string} tag */
/**
* @param {string} tag
*/
/*
const isInlineTag = (tag) => {
return /^(@link|@linkcode|@linkplain|@tutorial) /u.test(tag);
Expand Down
2 changes: 1 addition & 1 deletion src/rules/checkExamples.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default iterateJsdoc(({
/**
*
* @param {string} filename
* @param {string} [ext="md/*.js"] Since `eslint-plugin-markdown` v2, and
* @param {string} [ext] Since `eslint-plugin-markdown` v2, and
* ESLint 7, this is the default which other JS-fenced rules will used.
* Formerly "md" was the default.
* @returns {{defaultFileName: string, fileName: string}}
Expand Down
4 changes: 2 additions & 2 deletions src/rules/checkIndentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const maskExcludedContent = (str, excludeTags) => {
const regContent = new RegExp(`([ \\t]+\\*)[ \\t]@(?:${excludeTags.join('|')})(?=[ \\n])([\\w|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*@|\\/))`, 'gu');

return str.replace(regContent, (_match, margin, code) => {
return new Array(code.match(/\n/gu).length + 1).join(margin + '\n');
return Array.from({length: code.match(/\n/gu).length + 1}).join(margin + '\n');
});
};

const maskCodeBlocks = (str) => {
const regContent = /([ \t]+\*)[ \t]```[^\n]*?([\w|\W]*?\n)(?=[ \t]*\*(?:[ \t]*(?:```|@\w+\s)|\/))/gu;

return str.replace(regContent, (_match, margin, code) => {
return new Array(code.match(/\n/gu).length + 1).join(margin + '\n');
return Array.from({length: code.match(/\n/gu).length + 1}).join(margin + '\n');
});
};

Expand Down
6 changes: 2 additions & 4 deletions src/rules/requireThrows.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import iterateJsdoc from '../iterateJsdoc';
* We can skip checking for a throws value, in case the documentation is inherited
* or the method is either a constructor or an abstract method.
*
* @param {*} utils
* a reference to the utils which are used to probe if a tag is present or not.
* @returns {boolean}
* true in case deep checking can be skipped; otherwise false.
* @param {*} utils a reference to the utils which are used to probe if a tag is present or not.
* @returns {boolean} true in case deep checking can be skipped; otherwise false.
*/
const canSkip = (utils) => {
return utils.hasATag([
Expand Down
6 changes: 2 additions & 4 deletions src/rules/requireYields.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import iterateJsdoc from '../iterateJsdoc';
*
* In either of these cases the yield value is optional or not defined.
*
* @param {*} utils
* a reference to the utils which are used to probe if a tag is present or not.
* @returns {boolean}
* true in case deep checking can be skipped; otherwise false.
* @param {*} utils a reference to the utils which are used to probe if a tag is present or not.
* @returns {boolean} true in case deep checking can be skipped; otherwise false.
*/
const canSkip = (utils) => {
return utils.hasATag([
Expand Down

0 comments on commit a876af8

Please sign in to comment.