Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

348
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!