Skip to content

check-types can't decide on object vs. Object<> #860

Closed
@DamienCassou

Description

@DamienCassou

Expected behavior

I'm trying to update to version 38.1.0 but I have an issue with "object" arguments. I expect one of the following to be correct.

Either the lowercase "object":

 * @param {object<string, string>} spec - Foo.

but I get

  20:0  error  Invalid JSDoc @param "spec" type "object"; prefer: "Object<>"  jsdoc/check-types

or the uppercase object:

 * @param {Object<string, string>} spec - Foo.

but I get

  20:0  error  Invalid JSDoc @param "spec" type "Object"; prefer: "object"  jsdoc/check-types

Actual behavior

I'm very happy having to make my jsdoc uniform, but the check-type rule has to decide whether it wants uppercase or lowercase object, it can't be both :-).

ESLint Config

{
  "env": {},
  "globals": {},
  "parser": null,
  "parserOptions": {},
  "plugins": [
    "jsdoc"
  ],
  "rules": {
    "jsdoc/check-types": [
      "error"
    ]
  },
  "settings": {},
  "ignorePatterns": []
}

ESLint sample

/**
 * Does something.
 *
 * @param {object<string,string>} spec - Foo.
 */
function foo(spec) {
    return spec;
}

foo()

Environment

  • Node version: 16.14.2
  • ESLint version: v8.12.0
  • eslint-plugin-jsdoc version: 38.1.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions