eslint-plugin-jsdoc icon indicating copy to clipboard operation
eslint-plugin-jsdoc copied to clipboard

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

Open kraenhansen opened this issue 2 years ago • 1 comments

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

kraenhansen avatar Jun 21 '23 11:06 kraenhansen

also having this issue. it's preventing me from upgrading: https://github.com/flex-development/tutils/actions/runs/5439784079/jobs/9892093691?pr=296

unicornware avatar Jul 03 '23 02:07 unicornware