-
Notifications
You must be signed in to change notification settings - Fork 30k
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
CheckJS marks global variables and text in comments #26009
Comments
I agree with the issue with globals. We rely on Ramda as a global in most of our files, which means lots and lots of red lines everywhere. (It would be really sweet to go one step further, and actually give VSC the name of the dependency along with the global, so it could fetch the typings if they exist.) As for the float though, well float isn't valid in JS, since there's only a single number type. If you change |
@MikeyBurkman For globals, try creating a {
"compilerOptions": {
"checkJs": true
},
"typeAcquisition": {
"include": [
"ramda",
"jquery"
]
}
} This tells our tooling to include 'ramda' as a global module when analyzing JavaScript files. This works great for jquery, however the ramda |
Thanks for the information guys. Sometimes we like to use float or int so we can be more specific on the type of number we are expecting to handle even though I realize those are not valid JavaScript types so to speak. I had not seen anything about the typeAquisition option. I'll have to try that out and hopefully that will help remove a lot of the false errors. |
Closing as upstream |
I was having an issue with this and came across some other documentation that said you could declare global variable as comments in the top of the file ( I will use the typescript definition file, but was just hoping not having to introduce it to a JavaScript only project. Thanks |
From @sbowler on May 4, 2017 20:2
I'm not quite sure this is the right repo for this, but here goes. Using the latest released vscode I've tried to use the new checkJs compiler option. I'm not finding any way to mark global variables in client side code like lodash as valid so they are not flagged everywhere. Even better would be automatically reading them from ESLint config files, but that's another feature.
In addition it also seems to be scanning and marking items in jsdoc style comments as invalid like
* @param {float}
"Cannot find name float"
Copied from original issue: microsoft/vscode-languageserver-node#205
The text was updated successfully, but these errors were encountered: