The JavaScript warning "unreachable code after return statement" occurs when using an expression after a return statement, or when using a semicolon-less return statement but including an expression directly after.
(c) MDN
🐊Putout plugin adds ability to find and remove unreachable code.
npm i @putout/plugin-remove-unreachable-code
{
"rules": {
"remove-unreachable-code": "on"
}
}
function hi() {
return 'world';
console.log('hello');
}
function log() {
throw Error('error');
console.log('hello');
}
function hi() {
return 'world';
}
function log() {
throw Error('error');
}
MIT