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

'"$" is undefined' errors when using JQuery methods #301

Closed
ckib16 opened this issue Oct 21, 2015 · 7 comments

Comments

@ckib16
Copy link

commented Oct 21, 2015

Hey all - noob question that I couldn't find an answer for.

I'm getting multiple "$" is undefined errors from the linter when entering standard JQuery code. Do I have to add $ to the "ignored list", or is there better integration with JQuery that I'm missing to avoid these errors?

Thanks,
Chris
screen shot 2015-10-21 at 17 20 53

@ckib16

This comment has been minimized.

Copy link
Author

commented Oct 21, 2015

Apologies - wrong thread! Closing now.

@ckib16 ckib16 closed this Oct 21, 2015

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Oct 21, 2015

As $ is a non-standard property you probably want to do

const $ = window.$
@jprichardson

This comment has been minimized.

Copy link
Member

commented Oct 21, 2015

Or declare $ as a global in the file itself or package.json. See for more info: http://standardjs.com/#i-use-a-library-that-pollutes-the-global-namespace-how-do-i-prevent-variable-is-not-defined-errors

@ckib16

This comment has been minimized.

Copy link
Author

commented Oct 21, 2015

@yoshuawuyts @jprichardson Thanks guys. I mistakenly posted this here. I've closed it out and have moved it to the more relevant linter-js-standard repo - ricardofbarros/linter-js-standard#63

@jprichardson - if able, can you tell me how to actually get to package.json? I'm not sure I understand the path to that file.

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2015

@ckib16 ah yeah, package.json is an npm / commonjs thing. It allows you to declare dependencies and configuration in a central place, and pull them in separate from your source code.

If you want to learn more about npm, package.json and bundling tools such as browserify http://nodeschool.io/ might be a good place to start.

@ckib16

This comment has been minimized.

Copy link
Author

commented Oct 22, 2015

@yoshuawuyts Oh wow, OK. Much different than what I thought package.JSON was. I'm actually learning Node next week so I'll check into that then. Much appreciated!

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Oct 22, 2015

🙌

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.