43081j / 43081j/eslint-plugin-lit

Feature: add a rule stating that boolean attributes should default to false

Aberta
#219 0 comentários 4 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
138
Forks
26
Merge médio
23h 29min
PRs com merge (30d)
4

Descrição

> For a boolean property to be configurable from an attribute, it must default to false. If it defaults to true, you cannot set it to false from markup, since the presence of the attribute, with or without a value, equates to true. This is the standard behavior for attributes in the web platform.

This is an excerpt from the [lit docs](https://lit.dev/docs/components/properties/#boolean-attributes).

I've been bitten by this problem twice now. I think it may be interesting to add this as a rule?

For example, this should be flagged by the rule:

```ts
@property({ type: Boolean })
myBoolanProp = true;
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.