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

168
Visualizações
ESLint shared configuration for all rules within a plugin

I've created a es lint plugin that provides me with a rule which checks that provided import is not in a dynamic list of blacklisted imports.

The list is loaded from a JSON file.

Currently I am loading this file in the create method of a rule, but the rule is being recreated for each file, which in turn makes the linter slow.

I've found the following text in the ESLint documentation, but no other mention of a way to share some global object within an invocation of the linter.

https://eslint.org/docs/latest/user-guide/configuring/configuration-files#adding-shared-settings

ESLint supports adding shared settings into configuration files. Plugins use settings to specify information that should be shared across all of its rules. You can add settings object to ESLint configuration file and it will be supplied to every rule being executed. This may be useful if you are adding custom rules and want them to have access to the same information and be easily configurable.

Is this supported? I've tried exporting a settings object in the index.js of the plugin, but it is not being picked up at all.

module.exports.settings = {
    "sharedData": "Hello"
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Looks like I already have a workaround, but wondering if someone will come up with a better solution.

What I did in the end was to load the configuration in the index of the rule itself, which is loaded at the start of ESLint.

Instead of depending on context.getCwd() I've fallen back to _dirname. Which proved to be enough for my use case.

about 4 years ago · Juan Pablo Isaza Relatório
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