diff --git a/README.md b/README.md index 070c998d0..c8883460f 100644 --- a/README.md +++ b/README.md @@ -10996,6 +10996,16 @@ module.exports = class GraphQL { }; // Options: [{"checkRestProperty":true}] // Message: Missing JSDoc @param "fetchOptions.url" declaration. + +(function() { + /** + * A function. + */ + function f(param) { + return !param; + } +})(); +// Message: Missing JSDoc @param "param" declaration. ```` The following patterns are not considered problems: diff --git a/src/jsdocUtils.js b/src/jsdocUtils.js index ade6b5ae5..dfd8e7d50 100644 --- a/src/jsdocUtils.js +++ b/src/jsdocUtils.js @@ -767,7 +767,7 @@ const getTagsByType = (context, mode, tags, tagPreference) => { const getIndent = (sourceCode) => { let indent = sourceCode.text.match(/^\n*([ \t]+)/u); - indent = indent ? indent[1] + indent[1].charAt() : ' '; + indent = indent ? indent[1] + ' ' : ' '; return indent; }; diff --git a/test/rules/assertions/requireParam.js b/test/rules/assertions/requireParam.js index f02fea009..83103a6a4 100644 --- a/test/rules/assertions/requireParam.js +++ b/test/rules/assertions/requireParam.js @@ -1928,6 +1928,36 @@ export default { `, parser: require.resolve('babel-eslint'), }, + /* eslint-disable no-tabs */ + { + code: ` +(function() { + /** + * A function. + */ + function f(param) { + return !param; + } +})(); + `, + errors: [ + { + message: 'Missing JSDoc @param "param" declaration.', + }, + ], + output: ` +(function() { + /** + * A function. + * @param param + */ + function f(param) { + return !param; + } +})(); + `, + /* eslint-enable no-tabs */ + }, ], valid: [ {