Consider the following example:
/**
* Run a function on some data
*
* @param {object} data Some data to process
* @param {Function} [processor=data => data] A function to run
* @returns {object} Processed data
*/
function processData(data, processor = data => data) {
return processor(data)
}
Using 30.7.13 or lower, this is fine, but as of >=31.0.0 this now throws
1:1 error Missing JSDoc @param "processor" declaration jsdoc/require-param
5:0 error Expected @param names to be "data, processor". Got "data, " jsdoc/check-param-names
5:0 error Missing JSDoc @param "" description jsdoc/require-param-description
5:0 error There must be an identifier after @param tag jsdoc/require-param-name
Note this example (not using arrow syntax for the default):
/**
* Run a function on some data
*
* @param {object} data Some data to process
* @param {Function} [processor=function(data) { return data }] A function to run
* @returns {object} Processed data
*/
function processData(data, processor = data => data) {
return processor(data)
}
is fine with either version.
Is this a bug, or do I need to make a change to accommodate this version?
Example above (using arrow function) should be valid (I think?)
Provide a detailed description of how the software actually behaved
1:1 error Missing JSDoc @param "processor" declaration jsdoc/require-param
5:0 error Expected @param names to be "data, processor". Got "data, " jsdoc/check-param-names
5:0 error Missing JSDoc @param "" description jsdoc/require-param-description
5:0 error There must be an identifier after @param tag jsdoc/require-param-name
including any rationale for why that behavior is incorrect.
It was considered valid by <=30.7.13
What is the minimal config that reproduces the issue?
Disabling these rules silences the error
rules:
jsdoc/check-param-names: 'error'
jsdoc/require-param: 'error'
jsdoc/require-param-description: 'error'
jsdoc/require-param-name: 'error'
I've included the full output of eslint --print-config at the end of the issue
What code triggers the error?
/**
* Run a function on some data
*
* @param {object} data Some data to process
* @param {Function} [processor=data => data] A function to run
* @returns {object} Processed data
*/
function processData(data, processor = data => data) {
return processor(data)
}
eslint-plugin-jsdoc version: >=31.0.0 Full output of eslint --print-config:
{
"env": {
"node": true,
"es6": true,
"es2021": true
},
"globals": {
"document": "readonly",
"navigator": "readonly",
"window": "readonly"
},
"parser": "/home/chris/repositories/github_chris48s/shields/node_modules/@typescript-eslint/parser/dist/parser.js",
"parserOptions": {
"sourceType": "script",
"ecmaVersion": 2021,
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"node",
"react",
"@typescript-eslint",
"promise",
"react-hooks",
"import",
"sort-class-members",
"no-extension-in-require",
"mocha",
"jsdoc",
"chai-friendly"
],
"rules": {
"no-console": [
"off"
],
"no-empty": [
"error",
{
"allowEmptyCatch": true
}
],
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "none"
}
],
"no-unused-vars": [
"off",
{
"args": "none",
"caughtErrors": "none",
"ignoreRestSiblings": true,
"vars": "all"
}
],
"@typescript-eslint/no-var-requires": [
"off"
],
"no-extra-semi": [
"off"
],
"no-var": [
"error"
],
"prefer-const": [
"error",
{
"destructuring": "all",
"ignoreReadBeforeAssign": false
}
],
"strict": [
"error"
],
"arrow-body-style": [
"error",
"as-needed"
],
"no-extension-in-require/main": [
"error"
],
"object-shorthand": [
"error",
"properties"
],
"prefer-template": [
"error"
],
"promise/prefer-await-to-then": [
"error"
],
"func-style": [
"error",
"declaration",
{
"allowArrowFunctions": true
}
],
"new-cap": [
"error",
{
"capIsNew": true,
"newIsCap": true,
"properties": true
}
],
"import/order": [
"error",
{
"newlines-between": "never"
}
],
"no-unused-expressions": [
"off",
{
"allowShortCircuit": true,
"allowTernary": true,
"allowTaggedTemplates": true
}
],
"chai-friendly/no-unused-expressions": [
"error"
],
"jsdoc/require-jsdoc": [
"off"
],
"jsdoc/no-undefined-types": [
"error",
{
"definedTypes": [
"Joi"
]
}
],
"jsdoc/check-alignment": [
"error"
],
"jsdoc/check-param-names": [
"error"
],
"jsdoc/check-tag-names": [
"error"
],
"jsdoc/check-types": [
"error"
],
"jsdoc/implements-on-classes": [
"error"
],
"jsdoc/newline-after-description": [
"error"
],
"jsdoc/require-param": [
"error"
],
"jsdoc/require-param-description": [
"error"
],
"jsdoc/require-param-name": [
"error"
],
"jsdoc/require-param-type": [
"error"
],
"jsdoc/require-returns": [
"error"
],
"jsdoc/require-returns-check": [
"error"
],
"jsdoc/require-returns-description": [
"error"
],
"jsdoc/require-returns-type": [
"error"
],
"jsdoc/valid-types": [
"error"
],
"@typescript-eslint/camelcase": [
"off"
],
"@typescript-eslint/explicit-function-return-type": [
"off"
],
"@typescript-eslint/no-empty-function": [
"off"
],
"react/jsx-sort-props": [
"error"
],
"react-hooks/rules-of-hooks": [
"error"
],
"react-hooks/exhaustive-deps": [
"error"
],
"jsx-quotes": [
"error",
"prefer-double"
],
"constructor-super": [
"error"
],
"for-direction": [
"error"
],
"getter-return": [
"error"
],
"no-async-promise-executor": [
"error"
],
"no-case-declarations": [
"error"
],
"no-class-assign": [
"error"
],
"no-compare-neg-zero": [
"error"
],
"no-cond-assign": [
"error"
],
"no-const-assign": [
"error"
],
"no-constant-condition": [
"error",
{
"checkLoops": false
}
],
"no-control-regex": [
"error"
],
"no-debugger": [
"error"
],
"no-delete-var": [
"error"
],
"no-dupe-args": [
"error"
],
"no-dupe-class-members": [
"error"
],
"no-dupe-else-if": [
"error"
],
"no-dupe-keys": [
"error"
],
"no-duplicate-case": [
"error"
],
"no-empty-character-class": [
"error"
],
"no-empty-pattern": [
"error"
],
"no-ex-assign": [
"error"
],
"no-extra-boolean-cast": [
"error"
],
"no-fallthrough": [
"error"
],
"no-func-assign": [
"error"
],
"no-global-assign": [
"error"
],
"no-import-assign": [
"error"
],
"no-inner-declarations": [
"error"
],
"no-invalid-regexp": [
"error"
],
"no-irregular-whitespace": [
"error"
],
"no-misleading-character-class": [
"error"
],
"no-mixed-spaces-and-tabs": [
"error"
],
"no-new-symbol": [
"error"
],
"no-obj-calls": [
"error"
],
"no-octal": [
"error"
],
"no-prototype-builtins": [
"error"
],
"no-redeclare": [
"error",
{
"builtinGlobals": false
}
],
"no-regex-spaces": [
"error"
],
"no-self-assign": [
"error",
{
"props": true
}
],
"no-setter-return": [
"error"
],
"no-shadow-restricted-names": [
"error"
],
"no-sparse-arrays": [
"error"
],
"no-this-before-super": [
"error"
],
"no-undef": [
"error"
],
"no-unexpected-multiline": [
"error"
],
"no-unreachable": [
"error"
],
"no-unsafe-finally": [
"error"
],
"no-unsafe-negation": [
"error"
],
"no-unused-labels": [
"error"
],
"no-useless-catch": [
"error"
],
"no-useless-escape": [
"error"
],
"no-with": [
"error"
],
"require-yield": [
"error"
],
"use-isnan": [
"error",
{
"enforceForSwitchCase": true,
"enforceForIndexOf": true
}
],
"valid-typeof": [
"error",
{
"requireStringLiterals": true
}
],
"react/jsx-child-element-spacing": [
"off"
],
"react/jsx-closing-bracket-location": [
"off",
"tag-aligned"
],
"react/jsx-closing-tag-location": [
"off"
],
"react/jsx-curly-newline": [
"off",
{
"multiline": "consistent",
"singleline": "consistent"
}
],
"react/jsx-curly-spacing": [
"off",
{
"attributes": {
"when": "never"
},
"children": {
"when": "never"
},
"allowMultiline": true
}
],
"react/jsx-equals-spacing": [
"off",
"never"
],
"react/jsx-first-prop-new-line": [
"off",
"multiline-multiprop"
],
"react/jsx-indent": [
"off",
2,
{
"checkAttributes": false,
"indentLogicalExpressions": true
}
],
"react/jsx-indent-props": [
"off",
2
],
"react/jsx-max-props-per-line": [
"off"
],
"react/jsx-one-expression-per-line": [
"off"
],
"react/jsx-props-no-multi-spaces": [
"off"
],
"react/jsx-tag-spacing": [
"off",
{
"closingSlash": "never",
"beforeSelfClosing": "always",
"afterOpening": "never",
"beforeClosing": "never"
}
],
"react/jsx-wrap-multilines": [
"off",
{
"declaration": "parens-new-line",
"assignment": "parens-new-line",
"return": "parens-new-line",
"arrow": "ignore",
"condition": "ignore",
"logical": "ignore",
"prop": "ignore"
}
],
"react/jsx-space-before-closing": [
"off"
],
"standard/array-bracket-even-spacing": [
"off"
],
"standard/computed-property-even-spacing": [
"off"
],
"standard/object-curly-even-spacing": [
"off"
],
"@typescript-eslint/quotes": [
0
],
"@typescript-eslint/brace-style": [
"off"
],
"@typescript-eslint/comma-dangle": [
"off"
],
"@typescript-eslint/comma-spacing": [
"off"
],
"@typescript-eslint/func-call-spacing": [
"off"
],
"@typescript-eslint/indent": [
"off"
],
"@typescript-eslint/keyword-spacing": [
"off"
],
"@typescript-eslint/member-delimiter-style": [
"off"
],
"@typescript-eslint/no-extra-parens": [
"off"
],
"@typescript-eslint/no-extra-semi": [
"off"
],
"@typescript-eslint/semi": [
"off"
],
"@typescript-eslint/space-before-function-paren": [
"off"
],
"@typescript-eslint/space-infix-ops": [
"off"
],
"@typescript-eslint/type-annotation-spacing": [
"off"
],
"curly": [
0,
"multi-line"
],
"lines-around-comment": [
0
],
"max-len": [
0
],
"no-confusing-arrow": [
0
],
"no-mixed-operators": [
0,
{
"groups": [
[
"==",
"!=",
"===",
"!==",
">",
">=",
"<",
"<="
],
[
"&&",
"||"
],
[
"in",
"instanceof"
]
],
"allowSamePrecedence": true
}
],
"no-tabs": [
0
],
"quotes": [
0,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": false
}
],
"array-bracket-newline": [
"off"
],
"array-bracket-spacing": [
"off",
"never"
],
"array-element-newline": [
"off"
],
"arrow-parens": [
"off"
],
"arrow-spacing": [
"off",
{
"before": true,
"after": true
}
],
"block-spacing": [
"off",
"always"
],
"brace-style": [
"off",
"1tbs",
{
"allowSingleLine": true
}
],
"comma-dangle": [
"off",
{
"arrays": "never",
"objects": "never",
"imports": "never",
"exports": "never",
"functions": "never"
}
],
"comma-spacing": [
"off",
{
"before": false,
"after": true
}
],
"comma-style": [
"off",
"last"
],
"computed-property-spacing": [
"off",
"never",
{
"enforceForClassMembers": true
}
],
"dot-location": [
"off",
"property"
],
"eol-last": [
"off"
],
"func-call-spacing": [
"off",
"never"
],
"function-call-argument-newline": [
"off"
],
"function-paren-newline": [
"off"
],
"generator-star": [
"off"
],
"generator-star-spacing": [
"off",
{
"before": true,
"after": true
}
],
"implicit-arrow-linebreak": [
"off"
],
"indent": [
"off",
2,
{
"SwitchCase": 1,
"VariableDeclarator": 1,
"outerIIFEBody": 1,
"MemberExpression": 1,
"FunctionDeclaration": {
"parameters": 1,
"body": 1
},
"FunctionExpression": {
"parameters": 1,
"body": 1
},
"CallExpression": {
"arguments": 1
},
"ArrayExpression": 1,
"ObjectExpression": 1,
"ImportDeclaration": 1,
"flatTernaryExpressions": false,
"ignoreComments": false,
"ignoredNodes": [
"TemplateLiteral *",
"JSXElement",
"JSXElement > *",
"JSXAttribute",
"JSXIdentifier",
"JSXNamespacedName",
"JSXMemberExpression",
"JSXSpreadAttribute",
"JSXExpressionContainer",
"JSXOpeningElement",
"JSXClosingElement",
"JSXFragment",
"JSXOpeningFragment",
"JSXClosingFragment",
"JSXText",
"JSXEmptyExpression",
"JSXSpreadChild"
],
"offsetTernaryExpressions": true
}
],
"key-spacing": [
"off",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"off",
{
"before": true,
"after": true
}
],
"linebreak-style": [
"off"
],
"multiline-ternary": [
"off",
"always-multiline"
],
"newline-per-chained-call": [
"off"
],
"new-parens": [
"off"
],
"no-arrow-condition": [
"off"
],
"no-comma-dangle": [
"off"
],
"no-extra-parens": [
"off",
"functions"
],
"no-floating-decimal": [
"off"
],
"no-multi-spaces": [
"off"
],
"no-multiple-empty-lines": [
"off",
{
"max": 1,
"maxEOF": 0
}
],
"no-reserved-keys": [
"off"
],
"no-space-before-semi": [
"off"
],
"no-trailing-spaces": [
"off"
],
"no-whitespace-before-property": [
"off"
],
"no-wrap-func": [
"off"
],
"nonblock-statement-body-position": [
"off"
],
"object-curly-newline": [
"off",
{
"multiline": true,
"consistent": true
}
],
"object-curly-spacing": [
"off",
"always"
],
"object-property-newline": [
"off",
{
"allowMultiplePropertiesPerLine": true,
"allowAllPropertiesOnSameLine": false
}
],
"one-var-declaration-per-line": [
"off"
],
"operator-linebreak": [
"off",
"after",
{
"overrides": {
"?": "before",
":": "before",
"|>": "before"
}
}
],
"padded-blocks": [
"off",
{
"blocks": "never",
"switches": "never",
"classes": "never"
}
],
"quote-props": [
"off",
"as-needed"
],
"rest-spread-spacing": [
"off",
"never"
],
"semi": [
"off",
"never"
],
"semi-spacing": [
"off",
{
"before": false,
"after": true
}
],
"semi-style": [
"off"
],
"space-after-function-name": [
"off"
],
"space-after-keywords": [
"off"
],
"space-before-blocks": [
"off",
"always"
],
"space-before-function-paren": [
"off",
"always"
],
"space-before-function-parentheses": [
"off"
],
"space-before-keywords": [
"off"
],
"space-in-brackets": [
"off"
],
"space-in-parens": [
"off",
"never"
],
"space-infix-ops": [
"off"
],
"space-return-throw-case": [
"off"
],
"space-unary-ops": [
"off",
{
"words": true,
"nonwords": false
}
],
"space-unary-word-ops": [
"off"
],
"switch-colon-spacing": [
"off"
],
"template-curly-spacing": [
"off",
"never"
],
"template-tag-spacing": [
"off",
"never"
],
"unicode-bom": [
"off",
"never"
],
"wrap-iife": [
"off",
"any",
{
"functionPrototypeMethods": true
}
],
"wrap-regex": [
"off"
],
"yield-star-spacing": [
"off",
"both"
],
"indent-legacy": [
"off"
],
"no-spaced-func": [
"off"
],
"@typescript-eslint/adjacent-overload-signatures": [
"error"
],
"@typescript-eslint/ban-ts-ignore": [
"error"
],
"@typescript-eslint/ban-types": [
"error"
],
"camelcase": [
"off",
{
"allow": [
"^UNSAFE_"
],
"properties": "never",
"ignoreGlobals": true,
"ignoreDestructuring": false,
"ignoreImports": false
}
],
"@typescript-eslint/class-name-casing": [
"error"
],
"@typescript-eslint/consistent-type-assertions": [
"error"
],
"@typescript-eslint/interface-name-prefix": [
"error"
],
"no-array-constructor": [
"off"
],
"@typescript-eslint/no-array-constructor": [
"error"
],
"no-empty-function": [
"off"
],
"@typescript-eslint/no-empty-interface": [
"error"
],
"@typescript-eslint/no-explicit-any": [
"warn"
],
"@typescript-eslint/no-inferrable-types": [
"error"
],
"@typescript-eslint/no-misused-new": [
"error"
],
"@typescript-eslint/no-namespace": [
"error"
],
"@typescript-eslint/no-non-null-assertion": [
"warn"
],
"@typescript-eslint/no-this-alias": [
"error"
],
"no-use-before-define": [
"off",
{
"functions": false,
"classes": false,
"variables": false
}
],
"@typescript-eslint/no-use-before-define": [
"error"
],
"@typescript-eslint/prefer-namespace-keyword": [
"error"
],
"@typescript-eslint/triple-slash-reference": [
"error"
],
"prefer-rest-params": [
"error"
],
"prefer-spread": [
"error"
],
"react/jsx-no-bind": [
"error",
{
"allowArrowFunctions": true,
"allowBind": false,
"ignoreRefs": true,
"allowFunctions": false,
"ignoreDOMComponents": false
}
],
"react/no-did-update-set-state": [
"error"
],
"react/no-unknown-property": [
"error"
],
"react/no-unused-prop-types": [
"error"
],
"react/prop-types": [
"error"
],
"react/react-in-jsx-scope": [
"error"
],
"react/jsx-boolean-value": [
"error"
],
"react/jsx-curly-brace-presence": [
"error",
{
"props": "never",
"children": "never"
}
],
"react/jsx-fragments": [
"error",
"syntax"
],
"react/jsx-handler-names": [
"error"
],
"react/jsx-key": [
"error",
{
"checkFragmentShorthand": true,
"checkKeyMustBeforeSpread": false
}
],
"react/jsx-no-comment-textnodes": [
"error"
],
"react/jsx-no-duplicate-props": [
"error"
],
"react/jsx-no-target-blank": [
"error",
{
"enforceDynamicLinks": "always"
}
],
"react/jsx-no-undef": [
"error",
{
"allowGlobals": true
}
],
"react/jsx-pascal-case": [
"error",
{
"allowAllCaps": false
}
],
"react/jsx-uses-react": [
"error"
],
"react/jsx-uses-vars": [
"error"
],
"react/no-children-prop": [
"error"
],
"react/no-danger-with-children": [
"error"
],
"react/no-deprecated": [
"error"
],
"react/no-direct-mutation-state": [
"error"
],
"react/no-find-dom-node": [
"error"
],
"react/no-is-mounted": [
"error"
],
"react/no-string-refs": [
"error",
{
"noTemplateLiterals": true
}
],
"react/no-unescaped-entities": [
"error",
{
"forbid": [
">",
"}"
]
}
],
"react/no-render-return-value": [
"error"
],
"react/require-render-return": [
"error"
],
"react/self-closing-comp": [
"error"
],
"accessor-pairs": [
"error",
{
"setWithoutGet": true,
"enforceForClassMembers": true,
"getWithoutSet": false
}
],
"array-callback-return": [
"error",
{
"allowImplicit": false,
"checkForEach": false
}
],
"default-case-last": [
"error"
],
"dot-notation": [
"error",
{
"allowKeywords": true,
"allowPattern": ""
}
],
"eqeqeq": [
"error",
"always",
{
"null": "ignore"
}
],
"lines-between-class-members": [
"error",
"always",
{
"exceptAfterSingleLine": true
}
],
"no-caller": [
"error"
],
"no-useless-backreference": [
"error"
],
"no-eval": [
"error"
],
"no-extend-native": [
"error"
],
"no-extra-bind": [
"error"
],
"no-implied-eval": [
"error"
],
"no-iterator": [
"error"
],
"no-labels": [
"error",
{
"allowLoop": false,
"allowSwitch": false
}
],
"no-lone-blocks": [
"error"
],
"no-loss-of-precision": [
"error"
],
"no-multi-str": [
"error"
],
"no-new": [
"error"
],
"no-new-func": [
"error"
],
"no-new-object": [
"error"
],
"no-new-wrappers": [
"error"
],
"no-octal-escape": [
"error"
],
"no-proto": [
"error"
],
"no-return-assign": [
"error",
"except-parens"
],
"no-self-compare": [
"error"
],
"no-sequences": [
"error"
],
"no-template-curly-in-string": [
"error"
],
"no-throw-literal": [
"error"
],
"no-undef-init": [
"error"
],
"no-unmodified-loop-condition": [
"error"
],
"no-unneeded-ternary": [
"error",
{
"defaultAssignment": false
}
],
"no-unreachable-loop": [
"error"
],
"no-useless-call": [
"error"
],
"no-useless-computed-key": [
"error"
],
"no-useless-constructor": [
"error"
],
"no-useless-rename": [
"error"
],
"no-useless-return": [
"error"
],
"no-void": [
"error"
],
"one-var": [
"error",
{
"initialized": "never"
}
],
"prefer-promise-reject-errors": [
"error"
],
"prefer-regex-literals": [
"error",
{
"disallowRedundantWrapping": true
}
],
"spaced-comment": [
"error",
"always",
{
"line": {
"markers": [
"*package",
"!",
"/",
",",
"="
]
},
"block": {
"balanced": true,
"markers": [
"*package",
"!",
",",
":",
"::",
"flow-include"
],
"exceptions": [
"*"
]
}
}
],
"symbol-description": [
"error"
],
"yoda": [
"error",
"never"
],
"import/export": [
"error"
],
"import/first": [
"error"
],
"import/no-absolute-path": [
"error",
{
"esmodule": true,
"commonjs": true,
"amd": false
}
],
"import/no-duplicates": [
"error"
],
"import/no-named-default": [
"error"
],
"import/no-webpack-loader-syntax": [
"error"
],
"node/handle-callback-err": [
"error",
"^(err|error)$"
],
"node/no-callback-literal": [
"error"
],
"node/no-deprecated-api": [
"error"
],
"node/no-exports-assign": [
"error"
],
"node/no-new-require": [
"error"
],
"node/no-path-concat": [
"error"
],
"node/process-exit-as-throw": [
"error"
],
"promise/param-names": [
"error"
]
},
"settings": {
"react": {
"version": "16.8"
},
"jsdoc": {
"mode": "jsdoc"
},
"linkComponents": [
"Link"
]
},
"ignorePatterns": [
"/api-docs/",
"/build",
"/coverage",
"/__snapshots__",
"/public",
"badge-maker/node_modules/"
]
}
V31 switched to a new version of comment-parser which helps preserve whitespace but which still has a few hiccups to work out (also #669), so good to have reported this. I filed https://github.com/syavorsky/comment-parser/issues/112 , so I think we are now blocking on that.
:tada: This issue has been resolved in version 31.0.6 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Most helpful comment
:tada: This issue has been resolved in version 31.0.6 :tada:
The release is available on:
Your semantic-release bot :package::rocket: