Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

352
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda