43081j / 43081j/eslint-plugin-lit

no-private-properties checks only usage of attributes in HTML, not definition of property

Aberta
#255 0 comentários 0 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

no-private-properties rule checks only usage of attributes in HTML, I would like to forbid definition of private/protected properties/attributes. When a property is private it usually should be turned to a state.

This should be an error
```javascript
class Foo extends LitElement {
@property()
__fooProp;
}
```

And it should suggest to make it public or convert to a state
```javascript
class Foo extends LitElement {
@state()
__fooProp;
}
```

I can do the implementation and open a pull request, but would you go by defining a new rule ? (in that case with which name ?) Or by completing existing rule `no-private-properties` to reject definition of private properties too ?

Guia de contribuição

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

Direção de pesquisa

Look at the existing rule 'no-private-properties' in the codebase to understand its current implementation. The issue is about extending this rule to also flag definitions of private properties (e.g., `__fooProp`) in LitElement classes. Check how the rule currently detects usage in HTML and adapt it to also inspect property definitions. The test suite for the rule will show how to verify the new behavior. Running the existing tests and adding new ones for the definition case will confirm the change works.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript
Domínio
devtools, testing-qa
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Pouca atividade
Clareza
Claramente especificada
Facilidade para iniciantes
65/100

Receba novas issues na sua caixa de entrada

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