Skip to content

[jsdoc/require-jsdoc] : 'FunctionDeclaration' = arrow functions ignored #612

@RichardFevrier

Description

@RichardFevrier

Expected behavior

When using the rule jsdoc/require-jsdoc with require with FunctionDeclaration set to true, the plugin should trigger an error on arrow functions declarations.

Actual behavior

Arrow functions declarations are ignored.

ESLint Config

module.exports = {
  root: true,
  globals: {
    'console': false
  },
  parser: "babel-eslint",
  extends: ['eslint:recommended', 'plugin:jsdoc/recommended'],
  rules: {
    'jsdoc/require-jsdoc': ['error', {
      require: {
        ArrowFunctionExpression: true,
        ClassDeclaration: false,
        ClassExpression: true,
        FunctionDeclaration: true, // <- should not ignore arrow functions
        FunctionExpression: true,
        MethodDefinition: true
      }
    }],
  },
};

ESLint sample

class Test {
  aFunc = () => {} // not detected
  anotherFunc() {} // detected
}

CLI sample

eslint myfile.js

Environment

  • Node version: 12.16.3
  • ESLint version: 6.8.0
  • eslint-plugin-jsdoc version: 30.0.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions