-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
no-undefined-types
doesn't read local variables
#178
Comments
Could not reproduce on v4.4.3 using the following settings. Might not be a bad idea to include your settings. "rules": {
"jsdoc/check-param-names": 2,
"jsdoc/check-tag-names": 2,
"jsdoc/require-hyphen-before-param-description": 2,
"jsdoc/require-param": 2,
"jsdoc/require-param-description": 2,
"jsdoc/require-param-name": 2,
"jsdoc/require-param-type": 2,
"jsdoc/check-types": 2,
"jsdoc/valid-types": 2,
"jsdoc/require-returns-type": 2,
"jsdoc/require-returns": 2,
"jsdoc/require-returns-check": 1,
"jsdoc/no-undefined-types": 1,
"jsdoc/check-examples": 0,
"jsdoc/require-example": 0,
"jsdoc/require-description": 0,
"jsdoc/require-description-complete-sentence": 0,
"jsdoc/newline-after-description": 0,
"jsdoc/require-returns-description": 0,
} |
Here you go:
You might have to uncomment some of the rules to trigger this issue. I forget. I worked around this issue by changing the way I was handling circular dependencies (https://stackoverflow.com/a/42264822/14731). Thanks. |
Reducing the config file to the following simplified test case replicates as well: module.exports = {
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"plugins": [
"jsdoc"
],
"rules": {
"jsdoc/no-undefined-types": "error"
}
}; |
And yes, the current behavior indeed only checks globals (or, in the case of modules, the module scope). |
no-undefined-types
doesn't read local variables
With #1098 now dropping |
@brettz9 Sorry, I can't figure out how to get typescript to flag invalid references in jsdoc. I've checked tsconfig docs, but can't find anything about checking references in jsdoc. How do you get typescript to check that types in jsdoc comments are defined instead of using this rule? |
Have you tried |
@brettz9 All my code is typescript, hence typechecked by tsc, so I had not. I added it just in case it's required to trigger typechecking of jsdoc in ts files, but typescript is still not reporting any issues: ![]() Note that the only issue on l.430 is the eslint issue but typescript issues are detected in the file (l.431). Typescript considers the type to be Do you have any references to typescript reporting invalid references in jsdoc, and how to activate it? My google-fu might be failing me but I struggle to find anything about it. Everything I come across - including Github Copilot - says that typescript doesn't do it and suggests using this eslint rule. |
Does your |
@brettz9 It does, but I have no
![]() |
My apologies. I was hoping to expedite things despite not having time then to read your message carefully.
Yes, for this reason, TypeScript users tend to put their types as TypeScript and then use the
For a variety of reasons, it is difficult to maintain the |
🎉 This issue has been resolved in version 50.6.7 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Given:
The plugin complains
The type 'TestClass' is undefined.
on line 23 (the@param
). I am expecting a method to know about its enclosing class.Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: