[TypeScript] vs code TSLint solutions to common errors

TSLint filter is a Typescrip {} t verification tool for detection code.


TSLint: comment must start with a space

(comment-format) Comments must begin (comment-format) from a space

that is after // must be followed by a space.

: ". Missing semicolon" ". Semicolon missing",
"." "The function form of the Use \" use strict \:. "Using standardized definitions function",
"Space After Unexpected '-'.": "In" - 'whitespace should rear ",.
the Expected value a the jSON." ":" Please pass json value of a ",.
" Mixed spaces and tabs. ":" TAB spaces and repeated ",.
" the Unsafe Character. ": . "unsafe characters",
"Long Line tOO.":. "the Bank of characters exceeds the specified maximum length",
"Trailing whitespace.":. "there are too many useless spaces at the end of the Bank",
"Scrip filter {} t URL. ":" script the URL ",.
" Unexpected in {a} '{b}'. ":." should in '{b}' {a} appears in ",
" Unexpected '{A } '. ":" this should not occur in' {A} ' ".
" strings MUST use doublequote. ":" string with double quotes ",
" Unnecessary its escapement. ":" need not escape "
"Control character in string: {a }.": " Appears in the character string of Control",
"the Avoid \\ '.": "Avoid \\",
"the Avoid \\ V.": "Avoid \\ V ",
" X-\\ the avoid. ":" X-avoiding \\ ",
" its escapement of Bad. ":" error escape character ",
" Number of Bad '{a}'. ":" wrong number ' A} { ' ",
" space after missing' {a} '. ":" in' {a} 'after missing spaces ",
" Extra use the Do not leading zeros' {a} '. ":" Do not' 'in front of a surplus 0 ", {a}
" the avoid 0x-.' {a}. '. ":." avoid using 0x-'} {a ' ",
" Point a trailing decimal confused with CAN BE a DOT '{a}'. ": " in '{a}' in the trailing decimal point ",
" Unexpected comment. ":" here should not comment appears in ",
" Unescaped '{a}'. ": " no escape '{a}' ",
" Unexpected control character in Regular expression the. ":" expressions appear just a control character ",
" Unexpected eSCAPED character '{a}' in Regular expression the. ":" the expression of positive appearing in formulas are not escaped characters '{a}' ",
"Expected '{a}' and instead saw '{b}'.": " Should '{a}' instead of '{B}'",
"Spaces are Hard to COUNT the Use {{A}}..": "space is difficult to calculate, using the a} {} {",
"insecure '{a}'.": " '{a}' unsafe",
"empty class.": "empty class",
"the Expected a number and instead saw '{a} '. ":" should numbers instead of '{A}' ",
" '{A}' should not bE Greater Within last '{B}'. ":" '{A}' is not should be less than '{b}' big ",
" 'hasOwnProperty' iS A Really Bad name. ":" 'hasOwnProperty' keyword ",
" '{A}' Used wAS IT wAS defined before. ":" 'A { } 'has been defined using a ",
"' {a} 'iS defined already. ":" "} {a' is defined repeat",
"a following a DOT Number confused with cAN bE a decimal Point.": "a point behind the figures will be mistaken for a decimal point",
"confusing minusses": "confusing negative expression -",
"confusing plusses.": "positive expression confusing +",
"Unmatched '{ a} '. ":" not match' {a} ' ",
"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.": " {C} in the row need '{a}' and '{b}' matching, used in place of '{D}' ",
" unexpected early End of program. ":" program unexpected early termination ",
" Point a leading decimal confused with CAN BE a DOT: " '{a}.'. : " '{a}' before the point of confusion to decimal",
"the use the array literal notation [].": "symbols array []",
"the Expected AN operator and INSTEAD SAW '{a}'." : "need a symbol instead of '{a}'",
"Unexpected space after '{a}'.": "not appear space after '{a}'",
"Unexpected space before '{a}'. ":" in '{a}' can not be a space appears before ",
" of Bad line Breaking before '{a}'. ":" in '{a}' before the error wrap ",
" the Expected '{a}' to have have an indentation at {b} instead at {c}. ":" '{a}' need not {b} at the indent in {C} ",
" line Breaking error '{A}'. ":" linefeed error '} {a' ",
" Unexpected use of '{a}'. ":" here can not be used '} {a' ",
" the operand of Bad. ":" incorrect operand ",
"Use the isNaN function to compare with NaN.": " Use isNaN to compare with NaN3",
"Confusing use of '{a}'.": "Confusing '{a}' use",
"the Read only. ":" read-only attribute, ",
" '{a}' iS a function. ":" '} {a' is a function ',
' assignment of Bad. ':' false assignment ",
" to the Do Not the aSSIGN exception parameter. ":" Do not give extra parameter assignment ",
" in the Expected identifier the AN AN iNSTEAD the assignment and the SAW a function invocation. ":" in the statement of the assignment requires an identifier, instead of calling a method of "
"Expected an identifier and instead saw ' {a}' (a reserved word).": " we need an identifier, rather than '{a}' (reserved characters)",
"Missing name in function Declaration.": " in the method declaration missing name ",
" AN identifier and the Expected iNSTEAD SAW '{a}'. ":" need an identifier, rather than '} {a' ",
" Functions Inner listed aT bE Should the Top of the outer function. ":" statement within the function should be placed at the top of this function ".
"Unreachable '{a}' after '{b}'.": " Not get after '{B}' '} {A'",
"Unnecessary SEMICOLON.": "Unnecessary semicolon",
"the Label ' {a} 'on {b} statement. ":" the' {a} '{b} on the statement ",
" the Label' {a} 'looks like {a filter javascrip} t url. ":"' {a} 'looks like a link of js ",
" the assignment or the Expected AN iNSTEAD function and the SAW AN expression the call ":" need an assignment or a function call, rather than an expression ",.
" the Do not use' new new 'for side effects. ":" Do not use'. new 'statement ",
" unnecessary \ "use strict \". ":." unnecessary \ "use strict \" ",
" Missing \ "use strict \" of statement . ":" missing \ "use strict \" statements ",
" empty block. ":" empty block ",
" Unexpected / * Member '{a}'. ":" should not occur / * element '{a } ' ",.
{a}' iS a statement label.": " '"' {a} 'is a statement ",
"' {a} 'used OUT of scope. ":"' {a} 'use exceeds range ",
" '{A}' IS Not allowed. ":" not allowed '{a}' ",
" '{A}' is not defined.": " '{A}' is not defined",
"the Use '{a}' to Compare with '{B}'.": "Use '{a}' and ' {b} 'in comparison ",
" Should the variables Not bE deleted. ":" to be deleted variable ",
" the use the object notation literal {}. ":" use object text symbols} { ",
" use the Do Not { a} as a constructor. ": " Do not use {a} as a constructed object ",
" of The Function constructor IS the eval. ":." of The Function constructor IS the eval ",
" a constructor name Should Start with AN UPPERCASE Letter. " : "name a constructed object must begin with a capital letter.",
"Bad constructor.": "false construct objects",
"Weird construction the delete 'new'..": "the object is constructed in error, please delete the 'new' ",
" missing '()' Invoking A constructor. ":" missing parentheses () ",
" the avoid arguments {A}.. ":" A avoid parameter} { ",..
" CAN BE A form of document.write eval. ":" document.write is a form of eval ",
'eval iS Evil.':" try not to use eval ",
"Math is not a function." : "Math is not a function",
"Missing 'new new' prefix the when Invoking A constructor.": "Here the lack of 'new new'",
"Missing radix the Parameter.": "Missing argument" ,
"a pass the Implied Evil the eval function iNSTEAD iS a string of..": "a transfer function, rather than a string",
"invocation of Bad.": "error calling",
"[ '{a}'] iS better written in dot notation. ": ". [ '{a}'] with the best way point ",
" extra comma. ":" extra comma ",
" the make the Do Not Functions WITHIN a Loop. ":" Do not create a circulating manner function ",
" Unexpected parameter '{a}' {b} in GET function. ":" {b} in the process parameters should not be used in '{} a' ",
" Member Duplicate '{ a} '. ":" duplicate'} {a ' ",
" See the Expected to statement a SAW INSTEAD a and Block. ":" declaration sentence should be here ",.
" too MANY statements var. ":" too multi var statement ",
" redefinition of '{a}'. ":" '} {a' is redefined "
"It is not necessary to initialize ' {a}' to 'undefined'.": " Is no need to '{a}' is initialized to 'undefined'",
"and the Expected A Conditional expression The SAW AN INSTEAD Assignment.": "Here requires an expression, rather than assignment ",
" the Expected a 'BREAK' of statement the before 'case'. ":." in the 'case' before the need for 'BREAK' ",
" the Expected a 'BREAK' the before of statement 'default' . ":" in the 'default' before the need for 'BREAK' ",.
" This 'switch' should bE AN 'IF'. ":." here 'switch' should be 'IF' ',
' All 'Debugger' statements should be removed. ":" Please delete 'debugger' statement ",
" '{a}' iS not a of statement label. ":." '{a}' is not a statement label ",
" the Expected AN the Assignment or function call and instead saw an expression. " :" the need for a statement or a function call, rather than an expression "
"Function declarations should not be placed in blocks Use a function expression or move the statement to the top of the outer function..": " Statement similar function can not be placed if the block needs to be placed on top of the external function."


Some tips for your own projects encountered, do some illustration:

1 [W099]: mixed spaces and tabs

this error is the most common, meaning that the same line, space, and Tab to indent mixed use, very simple modification generally remove Tab to indent, change all spaces. For convenience, we can put the editor Tab to indent set to two or four spaces to replace the original indentation.

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

of this error is very strange, I use the following code prompts the error index-1 <0 index = 0 :? Index = index - 1; this is a comma expression, but JSLInt think there should not be used expression, but must be a function, so if extremely concerned about this error, it will be changed if else statements

3 [W041]: use '=== ' to compare with ...

the mistake is to say, if we use congruent instead of equal, if both sides of the expression data type is the same, it is recommended to determine congruent

4 [W033]: Missing semicolon

Missing semicolon; this usually forget to write it myself, but noted that there is a need for only one structure, the back also need to write a semicolon. For example: if (index <0) { index = tcount-1} This code, wording is correct if (index <0) {index = tcount-1;}, I often forget where to write the semicolon, Khan ...

there are some other tips to control what mistakes to change it, to develop their own style and code of good writing habits.

 

Original link: https://www.itsvse.com/thread-5178-1-1.html

Guess you like

Origin www.cnblogs.com/changfeng1800/p/10986005.html