Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

167
Visualizações
Is it possible to create plugin without selector in eslint?

I want to create eslint plugin.

export const rule = ESLintUtils.RuleCreator(() => __filename)({
  name: RULE_NAME,
  meta: {
    type: 'problem',
    docs: {
      description: ``,
      recommended: 'error',
    },
    schema: [],
    messages: {},
  },
  defaultOptions: [],
  create(context) {
    return {};
  },
});

I'm not so familiar with eslint plugin.

From what I read in the eslint docs I need to return an object with a selector of what I looking for in the code (for example VariableDeclaration) and then I'll get the ts node in the callback function.

But is it possible to not return the selector, instead just to return callback and in this callback I'll get the root ts node and I'll do my own logic there with ts-morph?

I mean something like this possible to do with eslint?

import { ts } from 'ts-morph';
...

  create(context) {
    const rootNode = context.getRootNode() as ts.Node;
    const nodes = rootNode.getChildren().map(n => ....)

    nodes.forEach(node => {
      context.report({
        node,
        messageId: 'some'
      })
    })

  },
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda