43081j / 43081j/eslint-plugin-lit

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

未关闭
#208 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
138
派生
26
平均合并
23 小时 29 分钟
30 天内合并 PR
4

描述

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
```js
@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
```js
@property({type: Function) foo;
@property({type: Foo) foo;
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。