43081j / 43081j/eslint-plugin-lit

Linting svg tag function input

Aberta
#152 2 comentários 1 reação 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

As far as I can see, this plugin does not further lint the `svg` function input from `lit`.
But the rules that apply to the `html` syntax should also be appliable for `svg` from my point of view.

When looking at the code, then it seems to me that getting it to work at all, would require to not only check for `html`, but also for `svg`:
```ts
if (
node.type === 'TaggedTemplateExpression' &&
node.tag.type === 'Identifier' &&
['svg', 'html'].some(tag => tag === node.tag.name)
) {
```

Of course there is more to it, as it should be configurable if a rule should apply for both or only one.
Furthermore, I have not tested it, so this might not even work.

Is there any interest in extending `eslint-plugin-lit` to also lint code like:
```
const createElement = (chars: string): SVGTemplateResult => svg`
${chars}
`;
```
> source: https://lit.dev/tutorials/svg-templates/

Guia de contribuição

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

Direção de pesquisa

O issue aponta para a checagem de TaggedTemplateExpression no código-fonte do plugin, provavelmente em um arquivo como lib/index.js ou um arquivo de regra. Comece encontrando onde o plugin identifica os templates marcados com 'html'. Modifique a condição para corresponder também a 'svg', depois teste com o template SVG de exemplo. Verifique se as regras existentes se aplicam corretamente ao conteúdo SVG e considere opções de configuração para a aplicabilidade da regra.

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

Avaliação

Domínio
devtools, tooling
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

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