@putout/plugin-remove-unused-private-fields

putout plugin adds ability to remove unused private fields

Usage no npm install needed!

<script type="module">
  import putoutPluginRemoveUnusedPrivateFields from 'https://cdn.skypack.dev/@putout/plugin-remove-unused-private-fields';
</script>

README

putout-plugin-remove-unused-private-fields NPM version Dependency Status

putout plugin adds ability to remove unused private fields.

Install

npm i @putout/plugin-remove-unused-private-fields

Rule

Rule remove-unused-private-fields is enabled by default, to disable add to .putout.json:

{
    "rules": {
        "remove-unused-private-fields": false
    }
}

Code Example

const {readFileSync} = require('fs');
const source = readFileSync('./1.js', 'utf8');

const putout = require('putout');

console.log(source);
// outputs
`
class Hello {
    #a = 5;
    #b = 3;
    get() {
        return this.#a;
    };
}
`

const result = putout(source, {
    plugins: [
        'remove-unused-private-fields'
    ]
});
// returns
`
class Hello {
    #a = 5;
    get() {
        return this.#a;
    };
}
`

License

MIT