js-linter-configs icon indicating copy to clipboard operation
js-linter-configs copied to clipboard

eslint-config-adidas-typescript: disable valid-jsdoc

Open guoyunhe opened this issue 5 years ago • 2 comments
trafficstars

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
}

guoyunhe avatar Feb 14 '20 09:02 guoyunhe

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?

RecuencoJones avatar Feb 24 '20 08:02 RecuencoJones

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.

moelders avatar Mar 11 '20 09:03 moelders