We love the eslint rule require-jsdoc
... most of the time. But whenever we export a TS type (or interface), we're warned if we don't have a jsdoc block on not only the type itself, but also on each and every one of its properties.
We believe that TypeScript type declarations are - or at least should be - 90% self-documenting. Types themselves provide tons of documentation for the logic that consumes them. We do document certain ambiguous Types or properties, but we feel they mostly don't need it.
So, for instance:
export type I18nProviderProps = {
locale?: string
children: React.ReactNode
}
In that example, eslint throws a warning requiring separate jsdoc blocks for not only the type I18nProviderProps
, but for the lines locale?
and children
.
We think that's overkill. But, we can't figure out how to turn it off for either/both of these contexts. At a minimum, I'd be happy if there wasn't a warning for each and every prop on the type. But ideally I could turn it off for the whole type declaration too. Any suggestions?
I've read AST and Selectors in the plugin docs, and eslint's Selectors doc, to which it refers. Either there's not a specific enough selector to refer to this particular case, or I'm just not smart enough to see how it might work. So, any help would be appreciated.
Remove TSPropertySignature
from your contexts. Doc Examples