Skip to content
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

fix: allow decorated properties with class fields #201

Merged
merged 1 commit into from
May 14, 2024
Merged

Commits on May 14, 2024

  1. fix: allow decorated properties with class fields

    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.
    43081j committed May 14, 2024
    Configuration menu
    Copy the full SHA
    816d84c View commit details
    Browse the repository at this point in the history