You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe the issue is on hasThrowValue, when the node is an ArrowFunctionExpression, it checks for expression... that's always true, and unrelated to a throw, if the function doesn't have a body.
Was apparently a copy-paste bug (from the hasReturnValue function where expression on a function successfully denotes an (arrow) return value, but does not denote a throw statement).
Now fixed.
I also tweaked the rule to avoid something like the following reporting errors:
constnested=()=>()=>{thrownewError('oops');};
Since nested does not directly throw, its docs should not be indicating that it throws.
...nor does our current comment-detection approach (getJSDocComment in source) check comment blocks directly above expressions, so one couldn't get the nested block to be reported (though we probably should be checking for such blocks):
Expected behavior
There shouldn't be any errors on a fully documented function (arrow expression) without a body.
Actual behavior
The plugin is telling me that I'm missing a
@throws
declaration when there's nothrow
.ESLint Config
(I have a lot of other rules for the Airbnb preset, but I'm almost sure it's not affecting this issue)
ESLint sample
Environment
eslint-plugin-jsdoc
version: 28.6.0I believe the issue is on
hasThrowValue
, when the node is anArrowFunctionExpression
, it checks forexpression
... that's alwaystrue
, and unrelated to athrow
, if the function doesn't have a body.Writing
sum
this way doesn't trigger the rule:But it triggers arrow-body-style :P.
The text was updated successfully, but these errors were encountered: