When using the rule jsdoc/require-jsdoc with require with FunctionDeclaration set to true, the plugin should trigger an error on arrow functions declarations.
Arrow functions declarations are ignored.
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
}
}],
},
};
class Test {
aFunc = () => {} // not detected
anotherFunc() {} // detected
}
eslint myfile.js
eslint-plugin-jsdoc version: 30.0.0:tada: This issue has been resolved in version 30.0.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Thanks for the helpful reports!
There was missing support here (now fixed), but I might mention ArrowFunctionExpression is what you can use (FunctionDeclaration does not apply here with the case of ClassProperty). See https://astexplorer.net/ after setting the parser to explore the AST. Also, if you want fine-tuned control (e.g., checking arrow functions within ClassProperty only or such), you can use contexts. See the README for more.
Thank you for your answer 馃檪
And for the tips with https://astexplorer.net/
I effectively didn't know if it was ArrowFunctionExpression or FunctionDeclaration which would be triggered in that case.