43081j / 43081j/eslint-plugin-lit
Feature: add a rule stating that boolean attributes should default to false
- 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.