I have a userscript that loads jQuery using the @require directive in the metadata block:
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
I guess WebStorm doesn't "know" about userscripts, so it has no idea that that, say, $
is a function that will already be defined by the time I reference it in my userscript.
Can I make WebStorm believe that my file effectively has the contents of jquery.min.js
inlined at the top of the file, so that it'll stop giving me warnings about $
being undefined? e.g. can I maybe place a local copy of jquery.min.js
in a local folder somewhere and tell WebStorm that it can assume all declarations made in that file?
Thanks to hobbs for his comment - JetBrains has a documentation page for Configuring JavaScript Libraries.
What I did was:
And now WebStorm believes that my userscript loads jQuery. Hooray!