admin管理员组

文章数量:1429891

Using JSLint since some month, I wonder how to be fortable with it?

IMO the official website is too basic. No line number in the code editor, no links between error and code, poor presentation...

And using in CLI, is also not the more fortable way.

So the question is: "How do you use JSLint?". What are your practices and remendation to perform using JSLint? Is there any alternative online checker that are more powerful? Or maybe advanced online editor that include JSLint validator?

Using JSLint since some month, I wonder how to be fortable with it?

IMO the official website is too basic. No line number in the code editor, no links between error and code, poor presentation...

And using in CLI, is also not the more fortable way.

So the question is: "How do you use JSLint?". What are your practices and remendation to perform using JSLint? Is there any alternative online checker that are more powerful? Or maybe advanced online editor that include JSLint validator?

Share Improve this question edited Oct 30, 2011 at 0:56 bmargulies 100k40 gold badges194 silver badges325 bronze badges asked Sep 23, 2011 at 7:06 jeanmonodjeanmonod 3152 silver badges7 bronze badges 1
  • what scripting language are you using?? – Baz1nga Commented Sep 23, 2011 at 7:10
Add a ment  | 

5 Answers 5

Reset to default 3

If you are using Visual Studio I highly remend the JSLint.VS2010 Extension. It integrates directly into the IDE. A few features I really like:

  • Choice of JSLint or JSHint (I prefer JSHint)
  • Granular control of check options to enable/disable exactly what gets validated
  • Automatically check files on project build
  • Ability to exclude files from check (useful for external libraries such as JQuery)
  • Right-click in IDE window to validate current file instantly
  • Ability to ment individual lines or code blocks to prevent validation. Useful when you want to break the rules deliberately occasionally
  • Click on warning message takes me directly to the offending line of code

Have you tried JSHint?

JSHint

It's a fork of JSLinl with some upgrades, for example like line number.

Anyway there're some plugin that you could add to your favorite text editor.

Don't be afraid to fork. JSLint is based on Crockford's personal ideas of code quality, and you might think different.

I use JSLint ("improved" version) as a pre-mit hook in git. This requires some Node or rhino installation, and saves me the trouble of running it manually.

Remember:

JSLint will hurt your feelings

You can get JSLint plugins for your preferred IDE. I use a JSLint validator along with Resharper 6 in Visual Studio, which gives me all of the things that you mention (I click on a warning, it takes me to the line of code).

On the JS Lint website you should get the line number and character along with a code snippet for any error in the warning message:

Problem at line 10 character 13: A constructor name 'myObject' should start with an uppercase letter.

var x = new myObject();

If you want to make JSLint part of your build process, do check out jslint4java. It works great for Java projects, but can also be applied to non-Java projects.

本文标签: javascriptHow to be comfortable with JSLint validatorStack Overflow