Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require-jsdoc autofix breaks export default arrow function #810

Closed
k03mad opened this issue Dec 9, 2021 · 1 comment · Fixed by #811
Closed

require-jsdoc autofix breaks export default arrow function #810

k03mad opened this issue Dec 9, 2021 · 1 comment · Fixed by #811

Comments

@k03mad
Copy link

k03mad commented Dec 9, 2021

Autofixing export with require-jsdoc rule:

export default (arg) => arg;

Expected behavior

/**
 * @param arg
 */
export default (arg) => arg;

Actual behavior

export default /**
eeeeeeeeeeeeeee * @param arg
* @param arg
eeeeeeeeeeeeeee */
(arg) => arg;

ESLint Config

https://github.com/k03mad/jsdoc-autofix-export-default-bug/blob/master/.eslintrc.json

{
  "env": {
    "es6": true
  },
  "parserOptions": {
    "sourceType": "module"
  },
  "plugins": [
    "jsdoc"
  ],
  "rules": {
    "jsdoc/require-jsdoc": [
      2,
      {
        "require": {
          "ArrowFunctionExpression": true,
          "ClassDeclaration": true,
          "ClassExpression": true,
          "FunctionDeclaration": true,
          "FunctionExpression": true,
          "MethodDefinition": true
        },
        "publicOnly": true
      }
    ],
    "jsdoc/require-param-name": 2,
    "jsdoc/require-param-type": 2,
    "jsdoc/require-param": 2
  }
}

ESLint sample

Repository with reproducible error: https://github.com/k03mad/jsdoc-autofix-export-default-bug

npm i
npm run lint:fix

Then check file test.js

Environment

  • Node version: 16.13.1
  • ESLint version 8.4.1
  • eslint-plugin-jsdoc version: 37.1.0
brettz9 added a commit to brettz9/eslint-plugin-jsdoc that referenced this issue Dec 9, 2021
brettz9 added a commit that referenced this issue Dec 9, 2021
@gajus
Copy link
Owner

gajus commented Dec 9, 2021

🎉 This issue has been resolved in version 37.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants