Skip to content

valid-types doesn't allow users to specify the properties of array items #596

@gurpreetatwal

Description

@gurpreetatwal

Expected behavior

valid-types should allow users to specify the properties of values in an array as documented on the JSDoc website: https://jsdoc.app/tags-param.html#parameters-with-properties

Actual behavior

  6:0  error  Syntax error in namepath: employees[].name        jsdoc/valid-types
  7:0  error  Syntax error in namepath: employees[].department  jsdoc/valid-types

ESLint Config

'use strict';

module.exports = {
  env: {
    node: true,
  },
  plugins: ['jsdoc'],
  rules: {
    'jsdoc/valid-types': [
      'error',
      { allowEmptyNamepaths: true, checkSeesForNamepaths: false },
    ],
  },
};

ESLint sample

'use strict';

/**
 * Assign the project to a list of employees.
 * @param {Object[]} employees - The employees who are responsible for the project.
 * @param {string} employees[].name - The name of an employee.
 * @param {string} employees[].department - The employee's department.
 */
function assign(employees) {
  // ...
}

Environment

  • Node version: v12.18.1
  • ESLint version: v7.3.1
  • eslint-plugin-jsdoc version: v28.5.1

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions