3.0.0 β€’ Published 5 months ago

@putout/plugin-remove-unreachable-code v3.0.0

Weekly downloads
2,938
License
MIT
Repository
github
Last release
5 months ago

@putout/plugin-remove-unreachable-code NPM version

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.

Install

npm i @putout/plugin-remove-unreachable-code

Rule

{
    "rules": {
        "remove-unreachable-code": "on"
    }
}

❌ Example of incorrect code

function hi() {
    return 'world';
    console.log('hello');
}

function log() {
    throw Error('error');
    
    console.log('hello');
}

βœ… Example of correct code

function hi() {
    return 'world';
}

function log() {
    throw Error('error');
}

License

MIT

2.2.0

9 months ago

2.1.1

9 months ago

3.0.0

5 months ago

2.1.0

9 months ago

2.0.0

9 months ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.0

6 years ago