JSLint – set exception options

I worked with JSLint today to clean up my local code. While cleaning, I encountered a parameter name that had underscore in its name. JSLint didn’t like this and complained. Since this parameter name was used to communicate with the server and could not be changed, I needed to set an exception in the JavaScript file. This led me to the options section of this page. All I had to do was adding the following line at the beginning of the JavaScript file and JSLint stopped complained about the issue:

/*jslint sub: true */
Advertisement

2 thoughts on “JSLint – set exception options

  1. Thank you for sharing.
    I also run into an issue where I write code using jQuery (and $) and linting keep reminding me that “$ is not defined”. I looked at the documentation and found the option “global” which in my case is placed in the top of the javascript file like this:
    /*global jQuery, $ */
    Then I do not get error messages about those two objects being defined.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s