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

feat: add a rule to ensure attribute is set to false when type is not serializable #208

Open
jpradelle opened this issue Jul 23, 2024 · 0 comments

Comments

@jpradelle
Copy link
Contributor

I think it would be great to have a rule to forbid usage of attribute for a property if type is not natively convertible or if no converter is defined.
Native convertible types are String, Number, Boolean, Object, Array : https://lit.dev/docs/components/properties/#conversion-type

This would be no warning

@property() foo;
@property({type: String) foo;
@property({type: Boolean) foo;
@property({type: Number) foo;
@property({type: Array) foo;
@property({type: Object) foo;
@property({type: Foo, converter: {fromAttribute: ..., toAttribute: ...}) foo;
@property({type: Foo, attribute: false) foo;

And this would be warning

@property({type: Function) foo;
@property({type: Foo) foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant