Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

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

coderaiser47.4kMIT3.1.0

🐊Putout plugin adds ability to remove unused private fields

putout, putout-plugin, plugin, remove, unused, private, fields

readme

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

Class fields are public by default, but private class members can be created by using a hash # prefix. The privacy encapsulation of these class features is enforced by JavaScript itself.

(c) MDN

🐊Putout plugin adds ability to remove unused private fields.

Install

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

Rule

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

❌ Incorrect code example

class Hello {
    #a = 5;
    #b = 3;
    get() {
        return this.#a;
    }
}

✅ Correct code Example

class Hello {
    #a = 5;
    get() {
        return this.#a;
    }
}

Comparison

Linter Rule Fix
🐊 Putout remove-unused-private-fields
ESLint no-unused-private-class-members

License

MIT