Skip to content


FR: Error codes, for disabling specific errors, and for explaining errors #224

pickhardt opened this Issue · 5 comments

4 participants


Request to use error codes, like Closure.

Then have a command to map from error codes to responsible rule(s) along with an explanation or two of why the rule may be important.

"jscs explain E101"
E101: Line too long.
This error is thrown by ruleset(s): maximumLineLength, [anything else would go here]

Long line can be hard to read and understand. Most projects require 80 characters, although some modern projects increase that to 120 characters.

If your code starts to get indented way to the right, consider breaking your code into more methods.

If you need a longer line for some reason, use parentheses or multiple strings.

BAD: if (condition1 && (condition2 || condition3) && condition4 && condition5)
GOOD: if (condition1 && (condition2 || condition3) &&
                condition4 && condition5)
BAD:  x = "some really really really really really really really long line";
GOOD:  x = "some really really really really " +  
                  "really really long line"

Finally, allow disabling specific errors temporarily, such as:

var x = "reallyreallyreallylonglinegoeshere"; // jscs ignore E101

// Or, alternatively, this might be good:
/* jscs ignore E101 */
var x = "reallyreallyreallylonglinegoeshere"; // jscs ignore E101
/* jscs unignore E101 */
jscs-dev member

So i suppose we should add --verbose argument to cli module too?


Disabling specific errors with code comments should be handled separately (if at all).

Providing more details for each rule seems like a good idea. CSSLint does this via its wiki: - though they don't have "error codes".

The above example is fine, but most errors will be way too trivial to provide any details. If my code is function(){ and it should be function() {, what could you possibly be verbose about?


Disabling all validation was requested by #20.

@mikesherov mikesherov added this to the 1.6 milestone
@mikesherov mikesherov removed the cli label
@mikesherov mikesherov modified the milestone: 1.6

Thanks for contributing! All of our rules are named, and therefore this should be satisfied with outputting the rule name if verbose is supplied. I'm going to file a new issue with that as the request. Thanks again!

@mikesherov mikesherov closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.