-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False negative lit/no-classfield-shadowing #193
Comments
do you have an example? may be that the rule just doesn't make sense with new decorators, but would have to see an example to be sure |
Here's the smallest I could quickly concoct by extracting the setup from my project: https://gist.github.com/tpluscode/149377e20f27a47ae0e02fdd453f10a7 |
|
We have the same problem with Home Assistant, except it occurs when upgrading to 1.12.0. We went from 0 errors to over 6000: https://github.com/home-assistant/frontend/actions/runs/9081979074/job/24957190667?pr=20775 There was no change to config and deleting cache has no effect. Note the breakage also affects the |
Allows properties decorated with lit property decorators to have class fields alongside. This loosens the strictness of the rule under the assumption you have set `useDefineForClassFields: false` in typescript. If you use `declare` or `accessor`, those fields will already be ignored by this rule. Examples: ```ts // Error class X extends LitElement { fieldA; static properties = {fieldA: {type: String}}; } // Works now, errored before class X extends LitElement { @Property() fieldA; } // Worked before, works now class X extends LitElement { @Property() declare fieldA; } // Worked before, works now class X extends LitElement { declare fieldA; static properties = {fieldA: {type: String}}; } // Worked before, works now class X extends LitElement { @Property() accessor fieldA; } ``` Fixes #193.
Allows properties decorated with lit property decorators to have class fields alongside. This loosens the strictness of the rule under the assumption you have set `useDefineForClassFields: false` in typescript. If you use `declare` or `accessor`, those fields will already be ignored by this rule. Examples: ```ts // Error class X extends LitElement { fieldA; static properties = {fieldA: {type: String}}; } // Works now, errored before class X extends LitElement { @Property() fieldA; } // Worked before, works now class X extends LitElement { @Property() declare fieldA; } // Worked before, works now class X extends LitElement { declare fieldA; static properties = {fieldA: {type: String}}; } // Worked before, works now class X extends LitElement { @Property() accessor fieldA; } ``` Fixes #193.
Allows properties decorated with lit property decorators to have class fields alongside. This loosens the strictness of the rule under the assumption you have set `useDefineForClassFields: false` in typescript. If you use `declare` or `accessor`, those fields will already be ignored by this rule. Examples: ```ts // Error class X extends LitElement { fieldA; static properties = {fieldA: {type: String}}; } // Works now, errored before class X extends LitElement { @Property() fieldA; } // Worked before, works now class X extends LitElement { @Property() declare fieldA; } // Worked before, works now class X extends LitElement { declare fieldA; static properties = {fieldA: {type: String}}; } // Worked before, works now class X extends LitElement { @Property() accessor fieldA; } ``` Fixes #193.
As I updated the plugin to v1.11, I now have
lit/no-classfield-shadowing
everywhere, for properties declared withlit@2
decoratorsThe text was updated successfully, but these errors were encountered: