@putout/plugin-remove-unreachable-code

putout plugin adds ability to find and remove unreachable code

Usage no npm install needed!

<script type="module">
  import putoutPluginRemoveUnreachableCode from 'https://cdn.skypack.dev/@putout/plugin-remove-unreachable-code';
</script>

README

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

putout plugin adds ability to find and remove unreachable code.

Install

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

Rule

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

❌ Incorrect code example

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

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

✅ Correct code Example

function hi() {
    return 'world';
}

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

License

MIT