Skip to content

Commit

Permalink
refactor: avoid reporting of unused vars. by TS checker
Browse files Browse the repository at this point in the history
Also remove no longer relevant `deprecated` jsdoc tag.
  • Loading branch information
brettz9 committed Oct 30, 2020
1 parent 6163f3c commit c7426b2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/eslint/getJSDocComment.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ const getReducedASTNode = function (node, sourceCode) {
* @returns {Token|null} The Block comment token containing the JSDoc comment
* for the given node or null if not found.
* @public
* @deprecated
*/
const getJSDocComment = function (sourceCode, node, settings) {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/jsdocUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ const getPreferredTagName = (
// e.g. 'tag constructor' for 'constructor':
// https://github.com/eslint/eslint/issues/13289
// https://github.com/gajus/eslint-plugin-jsdoc/issues/537
const tagPreferenceFixed = _.mapKeys(tagPreference, (value, key) => {
const tagPreferenceFixed = _.mapKeys(tagPreference, (_value, key) => {
return key.replace('tag ', '');
});

Expand Down
4 changes: 2 additions & 2 deletions src/rules/checkIndentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import iterateJsdoc from '../iterateJsdoc';
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 str.replace(regContent, (_match, margin, code) => {
return new Array(code.match(/\n/gu).length + 1).join(margin + '\n');
});
};

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

return str.replace(regContent, (match, margin, code) => {
return str.replace(regContent, (_match, margin, code) => {
return new Array(code.match(/\n/gu).length + 1).join(margin + '\n');
});
};
Expand Down
4 changes: 2 additions & 2 deletions src/rules/checkParamNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const validateParameterNames = (
checkRestProperty : boolean,
checkTypesRegex : RegExp,
enableFixer: boolean,
functionParameterNames : Array<string>, jsdoc, jsdocNode, utils, report,
functionParameterNames : Array<string>, jsdoc, _jsdocNode, utils, report,
) => {
const paramTags = Object.entries(jsdoc.tags).filter(([, tag]) => {
return tag.tag === targetTagName;
Expand Down Expand Up @@ -167,7 +167,7 @@ const validateParameterNames = (
};

const validateParameterNamesDeep = (
targetTagName : string, allowExtraTrailingParamDocs: boolean,
targetTagName : string, _allowExtraTrailingParamDocs: boolean,
jsdocParameterNames : Array<string>, jsdoc, report : Function,
) => {
let lastRealParameter;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/checkTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default iterateJsdoc(({
exemptTagContexts = [],
} = context.options[0] || {};

const getPreferredTypeInfo = (type, nodeName, parentName, parentNode) => {
const getPreferredTypeInfo = (_type, nodeName, parentName, parentNode) => {
let hasMatchingPreferredType;
let isGenericMatch;
let typeName = nodeName;
Expand Down
2 changes: 1 addition & 1 deletion src/rules/requireDescriptionCompleteSentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const validateDescription = (
if (tag.tag) {
const reg = new RegExp(`(@${_.escapeRegExp(tag.tag)}.*)${_.escapeRegExp(beginning)}`, 'u');

text = text.replace(reg, ($0, $1) => {
text = text.replace(reg, (_$0, $1) => {
return $1 + capitalize(beginning);
});
} else {
Expand Down
4 changes: 2 additions & 2 deletions test/rules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const ruleTester = new RuleTester();

if (process.env.npm_config_invalid) {
const indexes = process.env.npm_config_invalid.split(',');
assertions.invalid = assertions.invalid.filter((assertion, idx) => {
assertions.invalid = assertions.invalid.filter((_assertion, idx) => {
return indexes.includes(String(idx)) ||
indexes.includes(String(idx - assertions.invalid.length));
});
Expand All @@ -101,7 +101,7 @@ const ruleTester = new RuleTester();
}
if (process.env.npm_config_valid) {
const indexes = process.env.npm_config_valid.split(',');
assertions.valid = assertions.valid.filter((assertion, idx) => {
assertions.valid = assertions.valid.filter((_assertion, idx) => {
return indexes.includes(String(idx)) ||
indexes.includes(String(idx - assertions.valid.length));
});
Expand Down

0 comments on commit c7426b2

Please sign in to comment.