4.0.0 β€’ Published 6 months ago

@putout/plugin-remove-unused-private-fields v4.0.0

Weekly downloads
2,935
License
MIT
Repository
github
Last release
6 months ago

@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

LinterRuleFix
🐊 Putoutremove-unused-private-fieldsβœ…
⏣ ESLintno-unused-private-class-members❌

License

MIT

3.1.0

9 months ago

4.0.0

6 months ago

3.0.0

10 months ago

2.1.0

4 years ago

2.0.0

4 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

7 years ago