43081j / 43081j/eslint-plugin-lit

[feat request] a `camel` option for `lit/attribute-names`

Đang mở
#226 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
138
Fork
26
Merge trung bình
23 giờ 29 phút
Pull request đã merge (30 ngày)
4

Mô tả

Right now it can only enforce `kebab-case` or `snake_case`. I'm not sure why `snake_case` is an option while a `camelCase` option doesn't exist. I have never seen anyone use `snake_case` for HTML attributes before.

By default in Lit, `@property() someValue = ""` will work with `someValue=` and `.someValue=` in Lit `html` templates. So we only need to add/remove a `.` character to switch between the two.

Furthermore `lit-plugin` will auto-complete what has been specified correctly. For typing `someV` or `.someV` will show a tooltip to auto-complete either `someValue` or `.someValue`in Lit's default configuration.

## Proposal

Add a new `camel` option for `lit/attribute-names` that allows enforcing that `attribute:` is not specified in `@property` decorators, and that attribute names in `html` templates will use the matching `camelCase` name (`camelCase=` or `.camelCase=`) from the class definition.

## With the option enabled:

```js
// no lint errors

@customElement('some-el')
class SomeEl exgtends Element {
@property() someValue = ""
}

html`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.