-
-
Notifications
You must be signed in to change notification settings - Fork 169
Closed
Description
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-jsdocversion: 30.7.8