js-linter-configs
js-linter-configs copied to clipboard
eslint-config-adidas-typescript: disable valid-jsdoc
In TypeScript project, sometimes the function can explain itself very well and here is no need to document parameters and returns:
/**
* ID should only contain letters, numbers, dashes and dots
*/
export function validateId(id: string): boolean | undefined {
if (id.length === 0) {
return
}
const match = id.match(/[A-Za-z0-9\-.]*/)
if (match && match.length && match[0] === id) {
return true
}
return false
}
Hi @guoyunhe, I would keep this rule as we would prefer to have JS and TS rulesets the most similar as possible.
If you check the configuration for the rule on eslint-config-adidas-es5, we are providing a rather large configuration object which – unfortunately – would require users to copy and paste in their configurations to have the same.
I find it easier to disable this in project level but have as default. What do you think @moelders?
Hi @guoyunhe, in this case, the rule I agree with @RecuencoJones of keeping this rule enable has more benefits globally, and you have the flexibility to modify it for your own project.
This rule comes from eslint-config-adidas-es5 package:
I would propose that you can overwrite valid-jsdoc (see valid-jsdoc options). In your case, just disabling some forced rules should be good:
{
extends: [
'adidas-typescript'
],
rules: {
'valid-jsdoc': [
'error', {
prefer: {
return: 'returns'
},
preferType: {
array: 'Array',
Boolean: 'boolean',
Number: 'number',
String: 'string'
},
requireParamDescription: false,
requireReturn: false,
requireReturnDescription: false
}
]
}
}
I hope that this solution fits well.