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
Currently, we can require @throws tag on functions that have a throw statement directly in their bodies. I think it would be great to take it to the next level and require the @throws tag for all errors that may be thrown by a function. All error handling is an important part of API behavior and should therefore be well documented. This is already done by languages such as Java.
Current behavior
// No error by ESLint :(
/**
* Description.
*/
function a() {
b();
}
/**
* @throws Error - Always throws an error.
*/
function b() {
throw new Error();
}
Desired behavior
// ESLint error: throws tag required for function a
/**
* Description.
*/
function a() {
b();
}
/**
* @throws Error - Always throws an error.
*/
function b() {
throw new Error();
}
The text was updated successfully, but these errors were encountered:
Motivation
Currently, we can require
@throws
tag on functions that have athrow
statement directly in their bodies. I think it would be great to take it to the next level and require the@throws
tag for all errors that may be thrown by a function. All error handling is an important part of API behavior and should therefore be well documented. This is already done by languages such as Java.Current behavior
Desired behavior
The text was updated successfully, but these errors were encountered: