The resource loading... loading...

JSLint detects the syntax of JavaScript

Author: Inventors quantify - small dreams, Created: 2017-01-10 10:19:32, Updated: 2017-01-10 10:24:05

JSLint detects the syntax of JavaScript

In front-end JavaScript coding, there's a nice tool called JSLint that can check the normalization of the code and see what JSLint's error prompts mean:

  • You are missing a semicolon. You are missing a period.

  • Use the function form of \use strict \.

  • Unnecessary space after - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  • Expected a JSON value. : Please input a JSON value.

  • Mixed spaces and tabs. Mixed spaces and tabs.

  • Unsafe characters. Unsafe: Unsafe characters.

  • Line too long. : The characters in the line exceed the maximum length set.

  • This is the first time I've seen this kind of thing in my life.

  • This is the URL of the script.

  • Unexpected {a} in {b}. : should not appear in the {b}, but should be in the {b}.

  • You're not supposed to be here. You're not supposed to be here. You're not supposed to be here.

  • Strings must use doublequote.

  • In addition to the above, there are also a number of other things that you can do in order to get rid of the problem.

  • Control character in string: {a}.: The Control character appears in the string.

  • You can't get away from it. You can't get away from it.

  • You can avoid \v.: you can avoid \v, you can avoid \v.

  • Avoid \x-.: Avoid \x-, and avoid \x-.

  • Bad escapement. Bad: Bad transliteration of the character bad.

  • Bad number {a} .: the wrong number {a}

  • Missing space after {a}. : Missing space after {a}

  • Don't use extra leading zeros. Don't use extra leading zeros.

  • Avoid 0x-. {a}.: Avoid using 0x-. {a}.

  • A trailing decimal point can be confused with a dot.

  • You should not have commented here, but you should have commented here.

  • You're not going to be able to get away with it.

  • Unexpected control character in regular expression.

  • Unexpected escaped character {a} in regular expression.

  • Expected {a} and instead saw {b}.

  • Spaces are hard to count. Use {{a}}.

  • I'm not sure if I'm safe or not, but I'm not sure I'm safe.

  • It's like an empty classroom.

  • Expected a number and instead saw {a}.

  • {a} should not be greater than {b}.

  • You have a really bad name, you have a really bad name, you have a really bad name.

  • {a} was used before it was defined.

  • {a} is already defined.

  • A dot following a number can be confused with a decimal point.

  • Confusing minusses: the confusing negative expressions of -i, -i, -i, -i, -i, -i, -i.

  • Confusing plusses.confusing: The confusing positive expression +confusing, which can be confused with +confusing, which can be confused with +confusing.

  • You can't match the size of a cat, you can't match the size of a cat.

  • Expected {a} to match {b} from line {c} and instead saw {d}.

  • Unforeseen early end of program.

  • A leading decimal point can be confused with a dot: .

  • Use the array literal notation [].

  • Expected an operator and instead saw {a}.

  • Unexpected space after {a}.

  • Unnecessary space before {a}. : The space bar cannot appear before {a}.

  • Bad line breaking before {a}. : Bad line breaking before {a}.

  • Expected {a} to have an indentation at {b} instead at {c}.: {a} needs to be indented at {c} instead of {b}

  • Line breaking error {a}.: switching line breaking error {a}

  • You can't use the word "a" here, but you can use the word "a" here.

  • It's a bad operand. It's a bad operand.

  • Use the isNaN function to compare with NaN.

  • Confusing use of {a}.: The use of {a} is confusing.

  • It's called "Read only".

  • {a} is a function.

  • I'm not sure if this is a good idea, but I'm not sure if it's a good idea, but it's a good idea.

  • Do not assign to the exception parameter.

  • Expected an identifier in an assignment and instead saw a function invocation.

  • Expected an identifier and instead saw {a} (a reserved word).

  • Missing name in function declaration.

  • Expected an identifier and instead saw {a}.

  • Inner functions should be listed at the top of the outer function.

  • Unreachable {a} after {b}. : {b} after {b} cannot be reached {a}, {b} after {b}

  • I'm not sure if you're familiar with this, but I'm not sure if you're familiar with it.

  • Label {a} on {b} statement.

  • It looks like a javascript url. It looks like a js link bar.

  • Expected an assignment or function call and instead saw an expression.

  • Do not use new for side effects.

  • It's not necessary. It's not necessary. It's not necessary.

  • Missing \use strict \ statement.

  • It's like the empty block. It's like the empty block.

  • It's not supposed to be there. It's not supposed to be there.

  • {a} is a statement label.

  • {a} used out of scope.

  • {a} is not allowed.

  • {a} is not defined.

  • Use {a} to compare with {b}.

  • Variables should not be deleted.

  • Use the object literal notation {}.

  • Do not use {a} as a constructor.

  • “The Function constructor is eval.”:“The Function constructor is eval.”,

  • A constructor name should start with an uppercase letter.

  • Bad constructor.Bad: Bad constructor is a bad constructor, bad constructor is a bad constructor.

  • Weird construction. Delete new. : The construction object is incorrect, please delete new, and delete new.

  • Missing () invoking a constructor

  • Avoid arguments.{a}.: Avoid arguments.{a}.: Avoid arguments.{a}.: Avoid arguments.

  • document.write can be a form of eval.

  • I'm not sure if I'll be able to do it, but I'm not sure if I'll be able to.

  • Math is not a function. : Math is not a function .

  • Missing new prefix when invoking a constructor.

  • It's called "Missing radix parameter".

  • Implicated eval is evil. Pass a function instead of a string.

  • Bad invocation.Bad invocation: Bad invocation is the wrong invocation.

  • [{a}] is better written in dot notation.

  • It's not just that I'm not a fan of the idea of using a comma, I'm also a fan of the idea of using a comma.

  • Don't make functions within a loop.

  • Unexpected parameter {a} in get {b} function.

  • It's a duplicate member. It's a duplicate member. It's a duplicate member.

  • I was expecting to see a statement and instead saw a block.

  • I'm not sure if this is a good idea, but I'm not sure if it's a good idea.

  • Redefinition of {a}.: {a} is a re-definition of , which is the same as {a}.

  • It is not necessary to initialize {a} to undefined.

  • Expected a conditional expression and instead saw an assignment.

  • Expected a break statement before case. : You need to have a break before case.

  • Expected a break statement before default.

  • This switch should be an if .: here switch should be an if .

  • All debugger statements should be removed.

  • {a} is not a statement label.

  • Expected an assignment or function call and instead saw an expression.

  • Use a function expression or move the statement to the top of the outer function.

  • Here are a few examples of tips I've come across in my own projects:

  • 1 [W099]:Mixed spaces and tabs

    This error is the most common, meaning that in the same line, spaces and tab shrinkage are used in combination. The modification is simple, generally removing tab shrinkage and changing it all to spaces. For convenience, we can set the editor's tab shrinkage to 2 or 4 spaces, to replace the original shrinkage.

  • 2 [W030]:Expected an assignment or function call and instead saw an expression

    This error is weird, and I'm using this error code index-1 <0? index = 0:index = index - 1; it's a comma expression, but JSLInt thinks it shouldn't be an expression, it has to be a function, so, if you really care about this error, just change it to the if else statement.

  • 3 [W041]:Use ‘===’ to compare with …

    This error is that if we replace the whole array with equal, if the data types on both sides of the expression are the same, we recommend using the whole array to judge.

  • 4 [W033]:Missing semicolon

    Missing the decimal point; this is usually something I forget to write, but one thing to note is that for only one sentence structure, a decimal point is also required. For example: if ((index<0) {index=tcount-1} This code, the correct spelling is if ((index<0) {index=tcount-1;}, I often forget to write the decimal point here, Khan...

  • There are also a few other misguided tips, so check them out and develop your own good coding style and writing habits.

Translated fromhttp://www.zystudios.cn/blog/post/70.ShtmlThe blog of the little girl


More