diff --git a/src/rules/noTypes.js b/src/rules/noTypes.js index 8e7121231..ed0cc1361 100644 --- a/src/rules/noTypes.js +++ b/src/rules/noTypes.js @@ -1,18 +1,20 @@ import iterateJsdoc from '../iterateJsdoc'; export default iterateJsdoc(({ - utils, - report + utils }) => { const tags = utils.getPresentTags(['param', 'arg', 'argument', 'returns', 'return']); tags.forEach((tag) => { if (tag.type) { - report(`Types are not permitted on @${tag.tag}.`, null, tag); + utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => { + tag.type = ''; + }); } }); }, { meta: { + fixable: true, type: 'suggestion' } }); diff --git a/test/rules/assertions/noTypes.js b/test/rules/assertions/noTypes.js index 9a172e84d..9ba1374d6 100644 --- a/test/rules/assertions/noTypes.js +++ b/test/rules/assertions/noTypes.js @@ -13,7 +13,15 @@ export default { { message: 'Types are not permitted on @param.' } - ] + ], + output: ` + /** + * @param foo + */ + function quux (foo) { + + } + ` }, { code: ` @@ -28,7 +36,15 @@ export default { { message: 'Types are not permitted on @returns.' } - ] + ], + output: ` + /** + * @returns + */ + function quux () { + + } + ` } ], valid: [