Skip to content

jsdoc/require-param not working #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
krutoo opened this issue Aug 14, 2019 · 8 comments
Closed

jsdoc/require-param not working #364

krutoo opened this issue Aug 14, 2019 · 8 comments

Comments

@krutoo
Copy link

krutoo commented Aug 14, 2019

Hi, i use this configuration:

{
  "plugins": [
    "jsdoc"
  ],
  "settings": {
    "jsdoc": {
        "tagNamePreference": {
          "arg": "param",
          "argument": "param",
          "class": "constructor",
          "virtual": "abstract",
          "returns": "return"
        },
        "preferredTypes": {
          "any": "*",
          "Null": "null",
          "Undefined": "undefined",
          "Boolean": "boolean",
          "Number": "number",
          "int": "number",
          "integer": "number",
          "float": "number",
          "String": "string",
          "Symbol": "symbol",
          "object": "Object",
          "array": "Array",
          "function": "Function"
        }
    }
  },
  "rules": {
    "jsdoc/valid-types": "error",
    "jsdoc/check-indentation": "error",
    "jsdoc/check-param-names": "error",
    "jsdoc/check-tag-names": "error",
    "jsdoc/require-param": "error",
    "jsdoc/require-param-type": "error",
    "jsdoc/require-param-name": "error",
    "jsdoc/require-param-description": "error",
    "jsdoc/require-returns": "error",
    "jsdoc/require-returns-check": "error",
    "jsdoc/require-returns-type": "error",
    "jsdoc/require-returns-description": "error",
    "jsdoc/newline-after-description": [
      "error",
      "never"
    ],
    "jsdoc/require-description-complete-sentence": [
      "error",
      {
        "tags": [
          "typedef",
          "property"
        ]
      }
    ],
    "jsdoc/no-undefined-types": [
      "error",
      {
        "definedTypes": [
          "ReactElement",
          "SyntheticEvent"
        ]
      }
    ],
  }
}

and this code does not provide ESLint error for missing param tag:

image

Please, help me resolve this problem. Thanks.

@golopot
Copy link
Collaborator

golopot commented Aug 15, 2019

This is a real bug. require-params fails when a param is object destructuring.

@brettz9
Copy link
Collaborator

brettz9 commented Sep 1, 2019

Dupe of #352. Fixed as of v15.6.2.

@brettz9 brettz9 closed this as completed Sep 1, 2019
@krutoo
Copy link
Author

krutoo commented Apr 20, 2020

It looks like it doesn't work again in 23.1.0

[email protected]
[email protected]

@brettz9
Copy link
Collaborator

brettz9 commented Apr 20, 2020

Are you getting the same exact error with the exact same config?

@krutoo
Copy link
Author

krutoo commented Apr 20, 2020

@brettz9 In my eslint config, I have these rules:

'jsdoc/require-param': 'error',
'jsdoc/require-param-description': 'error',

My code looks like:

/**
 * Something without param tag here.
 */
export function * handleScreenOpen ({ screenKey }) {

and it doesn’t give an error.

@krutoo
Copy link
Author

krutoo commented Apr 20, 2020

@brettz9 There is a full config:

ESLint configuration (large code snippet)

module.exports = {
  plugins: [
    'react',
    'jest',
    'import',
    'jsdoc',
  ],
  env: {
    browser: true,
    es6: true,
    node: true,
    'jest/globals': true,
  },
  settings: {
    react: {
      version: 'detect',
    },
    jsdoc: {
      tagNamePreference: {
        arg: 'param',
        argument: 'param',
        class: 'constructor',
        returns: 'return',
        virtual: 'abstract',
      },
      preferredTypes: {
        any: '*',
        array: 'Array',
        Boolean: 'boolean',
        float: 'number',
        function: 'Function',
        int: 'number',
        integer: 'number',
        Null: 'null',
        Number: 'number',
        object: 'Object',
        String: 'string',
        Symbol: 'symbol',
        Undefined: 'undefined',
      },
    },
  },
  extends: [
    'eslint:recommended',
    'plugin:react/recommended',
    'plugin:jsdoc/recommended',
  ],
  parser: 'babel-eslint',
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
    },
  },
  rules: {
    'array-bracket-newline': [
      'error',
      'consistent',
    ],
    'array-bracket-spacing': [
      'error',
      'never',
    ],
    'array-callback-return': 'error',
    'arrow-body-style': [
      'error',
      'as-needed',
    ],
    'arrow-parens': [
      'error',
      'as-needed',
    ],
    'arrow-spacing': [
      'error',
      {
        before: true,
        after: true,
      },
    ],
    camelcase: [
      'error',
      {
        properties: 'never',
        ignoreDestructuring: false,
      },
    ],
    'comma-dangle': [
      'error',
      {
        arrays: 'always-multiline',
        exports: 'always-multiline',
        imports: 'always-multiline',
        objects: 'always-multiline',
      },
    ],
    'comma-spacing': [
      'error',
      {
        before: false,
        after: true,
      },
    ],
    curly: [
      'error',
      'all',
    ],
    'dot-notation': 'error',
    'eol-last': [
      'error',
      'always',
    ],
    eqeqeq: 'error',
    'function-paren-newline': [
      'error',
      'consistent',
    ],
    'generator-star-spacing': [
      'error',
      {
        before: true,
        after: true,
      },
    ],
    'import/newline-after-import': [
      'error',
      {
        count: 1,
      },
    ],
    'import/no-anonymous-default-export': [
      'error',
      {
        allowAnonymousClass: false,
        allowAnonymousFunction: false,
        allowArray: false,
        allowArrowFunction: false,
        allowCallExpression: true,
        allowLiteral: false,
        allowObject: false,
      },
    ],
    indent: [
      'error',
      2,
      {
        SwitchCase: 1,
        MemberExpression: 1,
        ObjectExpression: 1,
        ignoredNodes: [
          'TemplateLiteral *',
        ],
      },
    ],
    'jest/no-disabled-tests': 'error',
    'jest/no-focused-tests': 'error',
    'jest/no-identical-title': 'error',
    'jest/prefer-to-have-length': 'error',
    'jest/valid-expect': 'error',
    'jsdoc/check-indentation': 'error',
    'jsdoc/check-param-names': 'error',
    'jsdoc/check-tag-names': 'error',
    'jsdoc/newline-after-description': [
      'error',
      'never',
    ],
    'jsdoc/no-undefined-types': [
      'error',
      {
        definedTypes: [
          'ReactElement',
          'SyntheticEvent',
        ],
      },
    ],
    'jsdoc/require-description-complete-sentence': [
      'error',
      {
        tags: [
          'typedef',
          'property',
        ],
      },
    ],
    'jsdoc/require-param': 'error',
    'jsdoc/require-param-description': 'error',
    'jsdoc/require-param-name': 'error',
    'jsdoc/require-param-type': 'error',
    'jsdoc/require-returns': 'error',
    'jsdoc/require-returns-check': 'error',
    'jsdoc/require-returns-description': 'error',
    'jsdoc/require-returns-type': 'error',
    'jsdoc/valid-types': 'error',
    'jsx-quotes': [
      'error',
      'prefer-single',
    ],
    'key-spacing': [
      'error',
      {
        mode: 'strict',
        beforeColon: false,
        afterColon: true,
      },
    ],
    'keyword-spacing': [
      'error',
      {
        before: true,
        after: true,
      },
    ],
    'lines-around-comment': [
      'error',
      {
        allowArrayEnd: true,
        allowArrayStart: true,
        allowBlockEnd: true,
        allowBlockStart: true,
        allowClassEnd: true,
        allowClassStart: true,
        allowObjectEnd: true,
        allowObjectStart: true,
        beforeBlockComment: true,
        beforeLineComment: true,
      },
    ],
    'max-len': [
      'error',
      {
        code: 120,
      },
    ],
    'no-array-constructor': 'error',
    'no-console': 'error',
    'no-duplicate-imports': 'error',
    'no-eval': 'error',
    'no-extra-boolean-cast': 'error',
    'no-extra-parens': [
      'error',
      'all',
      {
        ignoreJSX: 'all',
        nestedBinaryExpressions: false,
      },
    ],
    'no-implicit-coercion': 'error',
    'no-mixed-operators': 'error',
    'no-multi-assign': 'error',
    'no-multi-spaces': 'error',
    'no-multiple-empty-lines': [
      'error',
      {
        max: 1,
        maxBOF: 1,
        maxEOF: 0,
      },
    ],
    'no-nested-ternary': 'error',
    'no-new-func': 'error',
    'no-new-object': 'error',
    'no-new-wrappers': 'error',
    'no-param-reassign': [
      'error',
      {
        props: false,
      },
    ],
    'no-restricted-globals': [
      'error',
      'name',
      'status',
      'find',
      'event',
      'length',
    ],
    'no-shadow': [
      'error',
      {
        builtinGlobals: false,
      },
    ],
    'no-trailing-spaces': 'error',
    'no-undef': 'error',
    'no-unneeded-ternary': 'error',
    'no-use-before-define': [
      'error',
      {
        variables: false,
        functions: false,
        classes: false,
      },
    ],
    'no-useless-constructor': 'error',
    'no-useless-return': 'error',
    'no-var': 'error',
    'no-whitespace-before-property': 'error',
    'object-curly-spacing': [
      'error',
      'always',
      {
        arraysInObjects: true,
      },
    ],
    'object-shorthand': [
      'error',
      'always',
    ],
    'one-var': [
      'error',
      {
        var: 'never',
        let: 'never',
        const: 'never',
      },
    ],
    'operator-linebreak': [
      'error',
      'before',
    ],
    'padded-blocks': [
      'error',
      'never',
    ],
    'prefer-const': 'error',
    'prefer-template': 'error',
    'quote-props': [
      'error', 'as-needed',
    ],
    quotes: [
      'error',
      'single',
    ],
    radix: [
      'error',
      'as-needed',
    ],
    'react/display-name': [
      'off',
    ],
    'react/jsx-boolean-value': 'error',
    'react/jsx-closing-bracket-location': [
      'error',
      'tag-aligned',
    ],
    'react/jsx-curly-brace-presence': [
      'error',
      {
        props: 'never',
      },
    ],
    'react/jsx-curly-spacing': [
      'error',
      {
        when: 'never',
        children: true,
      },
    ],
    'react/jsx-equals-spacing': [
      'error',
      'never',
    ],
    'react/jsx-max-props-per-line': [
      'error',
      {
        when:
        'multiline',
      },
    ],
    'react/jsx-tag-spacing': [
      'error',
      {
        closingSlash: 'never',
        beforeSelfClosing: 'always',
        afterOpening: 'never',
        beforeClosing: 'never',
      },
    ],
    'react/jsx-uses-react': 'error',
    'react/jsx-uses-vars': 'error',
    'react/jsx-wrap-multilines': [
      'error',
      {
        declaration: 'parens-new-line',
        assignment: 'parens-new-line',
        return: 'parens-new-line',
        arrow: 'parens-new-line',
        condition: 'parens-new-line',
        logical: 'parens-new-line',
        prop: 'parens-new-line',
      },
    ],
    'react/no-children-prop': [
      'off',
    ],
    'react/prop-types': [
      'off',
    ],
    'require-jsdoc': [
      'error',
      {
        require: {
          ArrowFunctionExpression: true,
          ClassDeclaration: true,
          FunctionDeclaration: true,
          FunctionExpression: true,
          MethodDefinition: true,
        },
      },
    ],
    semi: [
      'error',
      'always',
    ],
    'space-before-blocks': 'error',
    'space-before-function-paren': [
      'error',
      'always',
    ],
    'space-in-parens': [
      'error',
      'never',
    ],
    'space-infix-ops': 'error',
    'spaced-comment': [
      'error',
      'always',
    ],
    'template-curly-spacing': [
      'error',
      'never',
    ],
    'template-tag-spacing': [
      'error',
      'never',
    ],
    'yield-star-spacing': [
      'error',
      {
        before: true,
        after: false,
      },
    ],
  },
};

@brettz9
Copy link
Collaborator

brettz9 commented Apr 20, 2020

Apologies, I don't think this was ever fixed. And this should have been categorized instead as a dupe of #11 . The current behavior is to silently pass over destructured items. Thankfully there is #498 which appears close to being ready for merging.

@krutoo
Copy link
Author

krutoo commented Apr 20, 2020

@brettz9 Ok, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants