1

I am using angular and would like to use JSHint. However, I get a lot of warnings like '$' is not defined., which would be correct in angular but JSHint does not know this.

Is there a way to ignore some certain errors (as this $-error occurs rather often) or is there a better linter for the JS of angular?

1 Answer 1

3

JsHint allows you define globals variables across your source code and a per file basis.

You can add a .jshintrc file and put the following snippet which will effect your entire code

{"predef": [ "$" ]}

A second option is to add /* global $ */ as a comment at the top of offending files.

See http://jshint.com/docs/#inline-configuration

Over all, I prefer eslint. It has functional parity with jshint, but also has the advantage of being very extensible. There are many existing eslint packages out there for handling angular specific linting errors and you have the option of writing your own rules

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.