@putout/plugin-remove-unreachable-code
Version:
πPutout plugin adds ability to find and remove unreachable code
58 lines (41 loc) β’ 1.19 kB
Markdown
[]: https://img.shields.io/npm/v/@putout/plugin-remove-unreachable-code.svg?style=flat&longCache=true
[]: https://npmjs.org/package/@putout/plugin-remove-unreachable-code"npm"
> 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](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Stmt_after_return)
π[**Putout**](https://github.com/coderaiser/putout) plugin adds ability to find and remove unreachable code.
```
npm i @putout/plugin-remove-unreachable-code
```
```json
{
"rules": {
"remove-unreachable-code": "on"
}
}
```
```js
function hi() {
return 'world';
console.log('hello');
}
function log() {
throw Error('error');
console.log('hello');
}
```
```js
function hi() {
return 'world';
}
function log() {
throw Error('error');
}
```
MIT