benquarmby / jslintnet

JSLint.NET is a wrapper for Douglas Crockford's JSLint, the JavaScript code quality tool. It can validate JavaScript anywhere .NET runs.
Apache License 2.0
77 stars 11 forks source link

jslint 2.0.1 & Angular #12

Closed rog536 closed 9 years ago

rog536 commented 9 years ago

How am I supposed to use the new version of JSLint.net with angular? Basic functionality like $watch no longer validates.

scope.$watch('myVariable',function(){});

Is it possible to get specific errors as warnings, but not all output? I don't want output like "Quotes are not needed around 'something'" to output as error, this line is in a localization file with a lot of text where most of the lines have spaces or something else that requires the quotes. I want consistent properties and half of them with quotes and half without.

{
    'Word':'Ord',
    'This is a sentance':'Detta är en mening'
}

How should I handle unused parameters now when I can't ignore specific lines?

var fn = function (ignore, ignore, b) {
       return b+1;
};
benquarmby commented 9 years ago

A lot of these issues have been discussed on the JSLint community on Google+, so my first suggestion is to head there and get it directly from the horse's mouth. JSLint Google+ Community

  1. You have a couple of options to deal with bad property name warnings:
    1. Use the /*property*/ directive. Anything listed there is not subject to quality checks. Once you start though, you must list all expected properties. JSLint.NET does not currently generate this directive for you, but it could. Raise an issue if you'd like to see it.
    2. Use the old version of JSLint by rolling back to JSLint.NET v1.x
  2. As for the localization file, I recommend adding it to the ignore list, particularly if it's automatically generated. Or convert it to full JSON, in which case the quotes become a requirement.
  3. APIs that require a lot of unused parameters are poorly designed, and the new JSLint is pretty intolerant of that. You can:
    1. Wrap the offending signatures in your own more sensible alternatives. This is potentially non-trivial, but I've been able to do this with code generation in the past.
    2. Again... roll back to 1.x.
benquarmby commented 9 years ago

Oh, and no, it's not currently possible to control the output of a specific type of JSLint warning. If you'd like to see that, please raise a separate issue.

rog536 commented 9 years ago

Using external libraries that has not been built while validated with jslint will almost always cause problems. I will rollback to an older version.

Thank you for your quick answer.

benquarmby commented 8 years ago

JSLint.NET v2.1.0 can now generate a property directive for you (#14). Hope it helps.