Skip to content
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

Method return type "this" #660

Closed
CemDemirkartal opened this issue Dec 2, 2020 · 1 comment
Closed

Method return type "this" #660

CemDemirkartal opened this issue Dec 2, 2020 · 1 comment

Comments

@CemDemirkartal
Copy link

Expected behavior

JSDoc supports "this" as a return type, but "eslint-plugin-jsdocs" takes it as undefined.

Actual behavior

{
  "resource": "****************/test.ts",
  "owner": "eslint",
  "code": {
    "value": "jsdoc/no-undefined-types",
    "target": {
      "$mid": 1,
      "external": "https://github.com/gajus/eslint-plugin-jsdoc#eslint-plugin-jsdoc-rules-no-undefined-types",
      "path": "/gajus/eslint-plugin-jsdoc",
      "scheme": "https",
      "authority": "github.com",
      "fragment": "eslint-plugin-jsdoc-rules-no-undefined-types"
    }
  },
  "severity": 4,
  "message": "The type 'this' is undefined.",
  "source": "eslint",
  "startLineNumber": 5,
  "startColumn": 1,
  "endLineNumber": 5,
  "endColumn": 1
}

ESLint Config

{
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": ["standard", "plugin:jsdoc/recommended"],
  "plugins": ["jsdoc"],
  "parserOptions": {
    "ecmaVersion": 2016,
    "sourceType": "module"
  },
  "rules": {
    "semi": ["error", "always"],
    "multiline-comment-style": "error", // for JSDOC
    "max-len": ["error", { "code": 80, "tabWidth": 4, "ignoreUrls": true }],
  },
  "overrides": [
    {
      // TypeScript
      "files": ["**/*.ts", "**/*.tsx"],
      "extends": ["standard-with-typescript"],
      "plugins": ["@typescript-eslint"],
      "parser": "@typescript-eslint/parser",
      "parserOptions": {
        "project": "./tsconfig.json"
      },
      "rules": {
        "max-len": "warn",
        "@typescript-eslint/semi": ["error", "always"]
      }
    }
  ]
}

ESLint sample

class Test {
  /**
   * Method.
   *
   * @returns {this} Return description.
   */
  method (): this {
    return this;
  }
}

Environment

  • Node version: 14.15.1
  • ESLint version 7.14.0
  • eslint-plugin-jsdoc version: 30.7.8
@gajus
Copy link
Owner

gajus commented Dec 19, 2020

🎉 This issue has been resolved in version 30.7.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Dec 19, 2020
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