“Missing semicolon.” : “缺少分号.”,

“Use the function form of \”use strict\”.” : “使用标准化定义function.”,

“Unexpected space after ‘-’.” : “在’-'后面不应出现空格.”,

“Expected a JSON value.” : “请传入一个json的值.”,

“Mixed spaces and tabs.”: “空格和TAB重复.”,

“Unsafe character.” : “不安全的字符.”,

“Line too long.”: “本行中的字符超过设定的最大长度.”,

“Trailing whitespace.”: “本行末尾有过多无用空格.”,

“Script URL.” : “脚本URL.”,

“Unexpected {a} in ‘{b}’.” : “在 ‘{b}’ 中不该出现 {a}.”,

“Unexpected ‘{a}’.” : “不该在此出现’{a}’.”,

“Strings must use doublequote.” : “字符串需要用双引号”,

“Unnecessary escapement.” : “不需要转义”,

“Control character in string: {a}.” : “在字符串中出现了Control的字符”,

“Avoid \\’.” : “避免 \\”,

“Avoid \\v.” : “避免 \\v”,

“Avoid \\x-.” : “避免 \\x-”,

“Bad escapement.” : “错误的转义字符”,

“Bad number ‘{a}’.” : “错误的数字 ‘{a}’”,

“Missing space after ‘{a}’.” : “在’{a}’之后缺少空格”,

“Don’t use extra leading zeros ‘{a}’.” : “不要再’{a}’的前面用多余的0″,

“Avoid 0x-. ‘{a}’.” : “避免使用 0x-. ‘{a}’.”,

“A trailing decimal point can be confused with a dot ‘{a}’.” : “在’{a}’中使用点尾随小数点”,

“Unexpected comment.” : “不该在此处出现注释”,

“Unescaped ‘{a}’.” : “没有转义 ‘{a}’”,

“Unexpected control character in regular expression.” : “在正则表达式中出现了control字符”,

“Unexpected escaped character ‘{a}’ in regular expression.” : “在正则表达式中出现了没有转义的字符 ‘{a}’”,

“Expected ‘{a}’ and instead saw ‘{b}’.” : “应该用 ‘{a}’代替’{b}’”,

“Spaces are hard to count. Use {{a}}.” : “空格难以统计,请使用 {{a}}”,

“Insecure ‘{a}’.” : “不安全的 ‘{a}’”,

“Empty class.” : “空的class”,

“Expected a number and instead saw ‘{a}’.”:“应该用数字代替’{a}’”,

“‘{a}’ should not be greater than ‘{b}’.”:“‘{a}’不应该比’{b}’大”,

“‘hasOwnProperty’ is a really bad name.”: “‘hasOwnProperty’是关键字”,

“‘{a}’ was used before it was defined.”:“‘{a}’未定义就已经使用了.”,

“‘{a}’ is already defined.”:“‘{a}’被重复定义”,

“A dot following a number can be confused with a decimal point.”:“数字后面的一个点会被误认为是十进制的小数点”,

“Confusing minusses” : “容易混淆的负数表达-”,

“Confusing plusses.” : “容易混淆的正数表达+”,

“Unmatched ‘{a}’.” : “无法匹配的’{a}’”,

“Expected ‘{a}’ to match ‘{b}’ from line {c} and instead saw ‘{d}’.”:“在行{c}中需要用’{a}’和’{b}’匹配,用来代替’{d}’”,

“Unexpected early end of program.”:“程序不可预期的提前终止”,

“A leading decimal point can be confused with a dot: ‘.{a}’.”:“‘{a}’前的点容易混淆成小数点”,

“Use the array literal notation [].”:“使用数组的符号 []“,

“Expected an operator and instead saw ‘{a}’.”:“需要用一个符号来代替’{a}’”,

“Unexpected space after ‘{a}’.”:“在’{a}’之后不能出现空格”,

“Unexpected space before ‘{a}’.”:“在’{a}’之前不能出现空格”,

“Bad line breaking before ‘{a}’.”:“在’{a}’之前错误的换行”,

“Expected ‘{a}’ to have an indentation at {b} instead at {c}.”:“‘{a}’需要在{c}而不是{b}处缩进”,

“Line breaking error ‘{a}’.”:“换行错误 ‘{a}’”,

“Unexpected use of ‘{a}’.”:“此处不能用’{a}’”,

“Bad operand.”:“错误的操作数”,

“Use the isNaN function to compare with NaN.”:“使用isNaN来与NaN比较”,

“Confusing use of ‘{a}’.”:“容易混淆的’{a}’的使用”,

“Read only.”:“只读的属性”,

“‘{a}’ is a function.”:“‘{a}’是一个函数”,

‘Bad assignment.’:“错误的赋值”,

“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).”:“需要有一个标识符,而不是’{a}’(保留字符)”,

“Missing name in function declaration.”:“在方法声明中缺少名称”,

“Expected an identifier and instead saw ‘{a}’.”:“需要有一个标识符,而不是’{a}’”,

“Inner functions should be listed at the top of the outer function.”:“内部函数的声明应该放在此函数的顶部。”,

“Unreachable ‘{a}’ after ‘{b}’.”:“在’{b}’之后无法获取’{a}’”,

“Unnecessary semicolon.”:“不必要的分号”,

“Label ‘{a}’ on {b} statement.”:“将’{a}’放在{b}的声明中”,

“Label ‘{a}’ looks like a javascript url.”:“‘{a}’看上去像一个js的链接”,

“Expected an assignment or function call and instead saw an expression”:“需要一个赋值或者一个函数调用,而不是一个表达式.”,

“Do not use ‘new’ for side effects.”:“不要用’new’语句.”,

“Unnecessary \”use strict\”.”:“不必要的\”use strict\”.”,

“Missing \”use strict\” statement.”:“缺少\”use strict\”的声明”,

“Empty block.”:“空的模块”,

“Unexpected /*member ‘{a}’.”:“不应出现 /*元素 ‘{a}’.”,

“‘{a}’ is a statement label.”:“‘{a}’是一个声明”,

“‘{a}’ used out of scope.”:“‘{a}’使用超出范围”,

“‘{a}’ is not allowed.”:“不允许使用’{a}’”,

“‘{a}’ is not defined.”:“‘{a}’没有被定义”,

“Use ‘{a}’ to compare with ‘{b}’.”:“使用’{a}’与’{b}’相比”,

“Variables should not be deleted.”:“变量需要被删除”,

“Use the object literal notation {}.”:“使用对象的文字符号 {}”,

“Do not use {a} as a constructor.”:“不要使用{a}作为一个构造对象”,

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

“A constructor name should start with an uppercase letter.”:“一个构造对象的名称必须用大写字母开头.”,

“Bad constructor.”:“错误的构造对象”,

“Weird construction. Delete ‘new’.”:“构造对象有误,请删除’new’”,

“Missing ‘()’ invoking a constructor.”:“缺少括号()”,

“Avoid arguments.{a}.”:“避免参数.{a}.”,

“document.write can be a form of eval.”:“document.write是eval的一种形式”,

‘eval is evil.’:“尽量不要使用eval”,

“Math is not a function.”:“Math不是一个函数”,

“Missing ‘new’ prefix when invoking a constructor.”:“此处缺少了’new’”,

“Missing radix parameter.”:“缺少参数”,

“Implied eval is evil. Pass a function instead of a string.”:“传递一个函数,而不是一个字符串”,

“Bad invocation.”:“错误的调用”,

“['{a}'] is better written in dot notation.”:“['{a}']最好用点.的方式”,

“Extra comma.”:“多余的逗号”,

“Don’t make functions within a loop.”:“不要用循环的方式创建函数”,

“Unexpected parameter ‘{a}’ in get {b} function.”:“在{b}方法中不该用到参数’{a}’”,

“Duplicate member ‘{a}’.”:“重复的’{a}’”,

“Expected to see a statement and instead saw a block.”:“此处应该是语句声明.”,

“Too many var statements.”:“过多var的声明”,

“Redefinition of ‘{a}’.”:“‘{a}’被重复定义”,

“It is not necessary to initialize ‘{a}’ to ‘undefined’.”:“无需将’{a}’初始化为’undefined’”,

“Expected a conditional expression and instead saw an assignment.”:“此处需要一个表达式,而不是赋值语句”,

“Expected a ‘break’ statement before ‘case’.”:“在’case’之前需要有’break’.”,

“Expected a ‘break’ statement before ‘default’.”:“在’default’之前需要有’break’.”,

“This ‘switch’ should be an ‘if’.”:“此处’switch’应该是’if’.”,

“All ‘debugger’ statements should be removed.”:“请删除’debugger’的语句”,

“‘{a}’ is not a statement label.”:“‘{a}’不是一个声明标签.”,

“Expected an assignment or function call and instead saw 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.”:“函数的声明不能放在类似if的块中,需要放在外部函数的顶部.”

针对自己项目中遇到的一些提示,做一些举例说明:

1 [W099]:Mixed spaces and tabs

这个错误是最常见的,意思是在同一行中,空格和Tab缩进混合使用了,修改很简单,一般是删除Tab缩进,全部改为空格。为了方便,我们可以把编辑器的Tab缩进设置成2个或4个空格,来代替原有的缩进。

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

这个错误提示的很诡异,我是用如下代码提示的这个错误 index-1 <0 ? index = 0:index = index - 1;  这是一个逗号表达式,但是JSLInt认为这里不应该用表达式,而必须是一个函数,所以,如果非常在乎这个错误,就改为if else 语句吧

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

这个错误是说,我们要是用全等来代替等于,如果表达式两边的数据类型是一致的话,建议使用全等来判断

4 [W033]:Missing semicolon

缺少分号;这个一般都是自己忘记写了吧,但是有一个需要注意的是,对于只有一句的结构,后面也需要写分号。例如:if(index<0) {index=tcount-1} 这句代码,正确写法是if(index<0) {index=tcount-1;},我是经常忘记这里写分号,汗...

其他还有一些错误提示就对照一下改吧,要培养自己良好的代码风格和书写习惯。

javascript 语法规范错误提示代码的更多相关文章

  1. js eslint语法规范错误提示代码

    最近在用eslint代码检测,因为之前不太注意代码规范,刚开始确实头疼,哈哈,不过用习惯了就会感觉还不错,其实也没有那样难调试 我看过之前有些人已经做过总结,自己记录下,方便自己以后查找 “Missi ...

  2. PCB 规则引擎之编辑器(语法着色,错误提示,代码格式化)

    对于一个规则引擎中的脚本代码编辑器是非常关键的,因为UI控件直接使用对象是规则维护者,关系到用户体验,在选用脚本编辑器的功能时除了满足代码的编辑的基本编辑要求外,功能还需要包含;语法着色,错误提示,代 ...

  3. JSLint检测Javascript语法规范

    前端javascript代码编写中,有一个不错的工具叫JSLint,可以检查代码规范化,压缩JS,CSS等,但是他的语法规范检查个人觉得太“苛刻”了,会提示各种各样的问题修改建议,有时候提示的信息我们 ...

  4. JavaScript语法规范

    推荐的JavaScript编码规范 阅读 247 评论 0 喜欢 0 作为前端开发人员,我相信每一个人都或多或少的用到原生的JavaScript,也正是因为用的人多,导致编码风格也是多种多样的,而不规 ...

  5. javascript语法规范和良好的变成习惯

    1.1空白和多行书写 1.空白:空格键输入的空白.tab键输入的空白以及回车键输入的空白 2.多行书写,不能将引号内的字符串放到两行,不然容易报错. 1.2点语法 . 点语法表达式由对象开始,接着是一 ...

  6. DELL_LCD错误提示代码

    代码 文本 原因E1000 Failsafe voltage error. Contact support.(故障保护电压错误.请联络支持人员.) 查看系统事件记录以了解严重故障事件.E1114 Am ...

  7. IDEA编写 Scala时没有语法检查和错误提示

    #问题描述 在IDEA中写scala程序时,一些明显的语法错误不进行检查,没有像写Java时的红线什么的,当编译运行时,编译失败. https://blog.csdn.net/weizheng1000 ...

  8. 关于pydev的语法的错误提示

    第三方包引入时,eclipse默认会把一些包定为错误的,错误是:“undefined variable from import...” 其实是对的,可是报错,很烦人 解决方法:window -- pr ...

  9. SmartGit 常见错误提示代码

    1.Failed to connect to newgit.op.ksyun.com port 80: Timed out. Could not update branch states (green ...

随机推荐

  1. linux 搜索文本

    find -type f -name '*.php'|xargs grep '127.0.0.1'  搜索所有.php 内容 127.0.0.1 转自:http://www.cnblogs.com/w ...

  2. 02.28 day03

    print(1 or 3 > 2 and 4 < 5 or 6 and 2 < 7)## while True:# print(11)# print(22)# # break# # ...

  3. Maven实战读书笔记(六):Maven灵活构建

    Maven为了支持构建的灵活性,内置了3大特性,即:属性.Profile和资源过滤. 6.1 Maven属性 Maven的属性与Java代码的常量有异曲同工之妙,都是为了消除重复,对相关内容进行统一管 ...

  4. C语言中函数参数传递的本质是值传递

    数组名做函数参数进行传递时,实际上是是一份该指针的拷贝. 给形参赋予其他值,并不影响实参的值. 类似于: int *p = a;    //a为数组名 p = b;          //b为数组名 ...

  5. JavaScript—获取当下往后七天的时间

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  6. 树莓派搭建Seafile个人网盘

    步骤一.安装Seafile依赖包 yum install python-setuptools python-ldap python-memcached MySQL-python mariadb mar ...

  7. 实现验证的vsftpd虚拟用户

    实现基于文件验证的vsftpd虚拟用户--(一台) 一.创建用户数据库文件 vim /etc/vsftpd/vuser cd /etc/vsftpd/ db_load -T -t hash -f vu ...

  8. Python模块学习 - openpyxl读写excel

    openpyxl模块介绍 openpyxl模块是一个读写Excel 2010文档的Python库,如果要处理更早格式的Excel文档,需要用到额外的库,openpyxl是一个比较综合的工具,能够同时读 ...

  9. Python变量及数据类型

    所有编程语言几乎都会有 ’ 变量‘ ,如 a = 2,用一个a变量指代数字2,在Python中,一切皆对象,因此在变量赋值的时候实际上是在内存中开辟了一块存储变量内容的内存空间对象. 对象可以指定不同 ...

  10. JS把数字金额转换成中文大写数字的函数

    //把数字金额转换成中文大写数字的函数 function num2rmb ($num){ $c1="零壹贰叁肆伍陆柒捌玖"; $c2="分角元拾佰仟万拾佰仟亿" ...