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

358
Visualizações
How do I configure eslint-plugin-jsdoc to disallow '*' and 'any' while using minimal set of rules?

I'm trying to set preferredTypes to prevent * or any as param/property types. I don't want to use most of the recommended rules as it flags up too many issues. I'm trying to ease my team onto using this lint rule set, and gradually fix issues and switch rules on later.

I thought preventing @param {*} would be easily done as per the docs:

settings.jsdoc.preferredTypes An option map to indicate preferred or forbidden types (if default types are indicated here, these will have precedence over the default recommendations for check-types).

So my .eslintrc.js settings object looks like:

...
settings: {
  ...
  jsdoc: { preferredTypes: { '*': false } }
}

And I have the rules 'jsdoc/valid-types', 'jsdoc/no-undefined-types', and 'jsdoc/check-tag-names' (picked as a balance of flagging bigger errors but not too many right now).

But I'm not seeing any reporting of errors on @param {*}.

Can this be done without adding extra jsdoc lint rules, or if it does need them can I customise it to it only hits {*} or {any}?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

At minimum you need jsdoc/check-types

This rule is referenced in the documentation for check-types and this rule is required, even though it's not explicit under the documentation for preferredTypes.

Here is the excerpt burried part way down the check-types examples:

/**
 * @param {*} baz
 */
function qux(baz) {
}
// Settings: {"jsdoc":{"preferredTypes":{"*":false,"abc":"Abc","string":"Str"}}}
// Message: Invalid JSDoc @param "baz" type "*".

Without check-types the preferred types setting does nothing, which, if you think about it makes sense.

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