Skip to content

no-undefined-types: Include instance property names in the set of defined types #1119

Open
@kraenhansen

Description

@kraenhansen

Expected behavior

I would like to be able to reference instance properties from an inline {@link ...} tag on a class and have the no-undefined-types rule recognise this as a defined type.

Actual behavior

Referencing an instance property name in an inline {@link } tag yields

The type 'foo' is undefined.

ESLint Config

{
  "parserOptions": {
    "ecmaVersion": "latest"
  },
  "extends": [
    "plugin:jsdoc/recommended"
  ],
  "rules": {
    "jsdoc/no-undefined-types": "warn"
  }
}

ESLint sample

class Foo {
  foo = "foo";
  /**
   * Something related to {@link foo}
   * @returns {string} Something awesome
   */
  bar() {
    return "bar";
  }
}

Environment

  • Node version: v18.9.0
  • ESLint version v8.43.0
  • eslint-plugin-jsdoc version: v46.2.6

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions