-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjshint_zh_CN.js
194 lines (192 loc) · 15.2 KB
/
jshint_zh_CN.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
'use strict';
const msg = {
"'hasOwnProperty' is a really bad name.": "不应使用'hasOwnProperty'作为名字",
"'with' is not allowed in strict mode.": "'with' 不允许在严格模式下使用",
"'{a}' has already been declared.": "'{a}' 已声明",
"'{a}' is a statement label.": "'{a}' 是声明标签",
"'{a}' is already defined in outer scope.": "'{a}'已经在外部作用域定义",
"'{a}' is already defined.": "'{a}'已经定义过了",
"'{a}' is available in ES{b} (use 'esversion: {b}') or Mozilla JS extensions (use moz).": "'{a}'只能在ES{b}或Mozilla JS扩展中使用。如果需要请使用选项 'esversion: {b}'或'moz'",
"'{a}' is defined but never used.": "'{a}'被定义以后,从未使用过",
"'{a}' is defined in a future version of JavaScript. Use a different variable name to avoid migration issues.": "'{a}' 在未来版本的JavaScript中已被定义。应换一个不同的变量名,以避免升级问题",
"'{a}' is not a statement label.": "'{a}'不是一个语句标签",
"'{a}' is not allowed.": "'{a}' 不是允许的",
"'{a}' is not defined.": "'{a}'未定义",
"'{a}' is only available in ES{b} (use 'esversion: {b}').": "'{a}'只能在ES{b}中使用。如果需要请使用选项 'esversion: {b}'",
"'{a}' is only available in Mozilla JavaScript extensions (use moz option).": "'{a}'只能在Mozilla JS扩展中使用。如果需要请使用选项 'moz'",
"'{a}' must be in function scope.": "'{a}'必须在函数的内部使用",
"'{a}' used out of scope.": "'{a}' 在作用域外使用",
"'{a}' was used before it was declared, which is illegal for '{b}' variables.": "使用'{a}'前未声明,这是非法的'{b}'变量",
"'{a}' was used before it was defined.": "'{a}'使用前未定义",
"['{a}'] is better written in dot notation.": "不应使用['{a}'],请使用'.{a}'",
'`var` declarations are forbidden. Use `let` or `const` instead.': '已禁用`var`声明,应该用`let`或`const`代替',
'A constructor name should start with an uppercase letter.': '构造函数的名称应以大写字母开头',
'A dot following a number can be confused with a decimal point.': '数字后面的一个点会被误认为是十进制的小数点',
'A generator function shall contain a yield statement.': 'Generator函数至少应该有一个yield语句',
"A leading decimal point can be confused with a dot: '{a}'.": "'{a}'容易与前置小数点的写法发生语义歧义",
"A regular expression literal can be confused with '/='.": "'/=' 会与正则表达式产生语义歧义",
"A trailing decimal point can be confused with a dot: '{a}'.": '小数点的位置可能会产生歧义{a}',
'A yield statement shall be within a generator function (with syntax: `function*`)': 'yield 语句应内一个生成器函数内(用`function*`语法)',
"A {a} cannot be named '{b}'.": "{a}不能命名为'{b}'",
"Attempting to override '{a}' which is a constant.": "试图重写'{a}'这是一个常量",
'Avoid arguments.{a}.': '不应使用arguments.{a}, 会让js引擎效率降低10倍',
'Avoid EOL escaping.': '应避免使用行结尾转义',
'Avoid {a}.': '不应使用{a}',
'Bad assignment.': '错误的赋值',
'Bad constructor.': '错误的构造函数',
'Bad escaping of EOL. Use option multistr if needed.': '错误的行结尾转义。如果需要请使用选项 multistr',
'Bad invocation.': '错误的调用',
"Bad line breaking before '{a}'.": '不应在’{a}’之前换行',
"Bad number '{a}'.": "错误的数字'{a}'",
'Bad operand.': '错误的操作数',
'Bad option value.': '错误的选项值',
"Bad option: '{a}'.": "错误的选项: '{a}'",
'Bad or unnecessary escaping.': '错误或不必要的转义',
'Blocks are nested too deeply. ({a})': '块嵌套太深。({a})',
"Class properties must be methods. Expected '(' but instead saw '{a}'.": "类的属性必须是函数。应该用'('而非'{a}'",
"Comma warnings can be turned off with 'laxcomma'.": "Comma warnings can be turned off with 'laxcomma'.",
'Confusing minuses.': '语义不清晰的负数表达+',
'Confusing plusses.': '语义不清晰的正数表达+',
"Confusing use of '{a}'.": "语义不清晰的使用 '{a}'",
"const '{a}' is initialized to 'undefined'.": "const '{a}'不应初始化为 undefined",
'Control character in string: {a}.': '字符串中不该有控制字符: {a}',
"Creating global 'for' variable. Should be 'for (var {a} ...'.": "不该创建全局var 变量。应该写'for (var ...'",
'Did you mean to return a conditional instead of an assignment?': '不应在返回值的同时赋值',
'Do not assign to the exception parameter.': '不应覆盖异常参数',
"Do not use 'new' for side effects.": "不应使用 'new' 语句",
'Do not use {a} as a constructor.': '不应用{a}作为构造函数',
'document.write can be a form of eval.': 'document.write是eval的另一种形式',
"Don't make functions within a loop.": '不要在循环内部声明函数',
"Don't use 'with'.": "不要用'with',太耗js引擎资源了",
"Don't use extra leading zeros '{a}'.": "不应使用额外前导0'{a}'",
"Duplicate {a} '{b}'.": "{a}与'{b}'重复",
'Each value should have its own case label.': '每个值都应有其自己的case标签',
'Empty array elements require elision=true.': '空数组隐式=true',
'Empty block.': '空的模块',
'Empty destructuring.': '空的解构赋值',
'ES5 option is now set per default': 'ES5 option is now set per default',
'eval can be harmful.': 'eval is evil. eval是恶魔,千万远离他!!',
"Expected '{a}' and instead saw '{b}'.": "应该为'{a}',而非'{b}'",
"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.": "'{a}'应该与{c}行的'{b}'匹配,但却与'{d}'匹配",
"Expected a 'break' statement before '{a}'.": "'{a}'之前应有一个'break'语句。考虑使用`/* falls through */`",
'Expected a conditional expression and instead saw an assignment.': '应为条件表达式,而非赋值',
'Expected a JSON value.': '应该是一个JSON值',
'Expected a single parameter in set {a} function.': 'set {a}函数应该只有一个参数',
"Expected a small integer or 'false' and instead saw '{a}'.": "此处应为小整数或false,而非'{a}'",
'Expected a string and instead saw {a}.': '应为一个字符串,而非{a}',
'Expected an assignment or function call and instead saw an expression.': '应该是赋值或者函数调用,而非表达式',
"Expected an identifier and instead saw '{a}' (a reserved word).": "应为赋值语句标识符,而非'{a}'(保留的字)",
"Expected an identifier and instead saw '{a}'.": "应为标识符,而非'{a}'",
'Expected an identifier in an assignment and instead saw a function invocation.': '应为赋值语句标识符,而非一个函数调用',
"Expected an operator and instead saw '{a}'.": "此处应为运算符,而非'{a}'",
'Expected to see a statement and instead saw a block.': '此处应为声明语句而非块语句',
'Export declaration must be in global scope.': 'export命令必须处于全局作用域',
"Extending prototype of native object: '{a}'.": "不该扩展原生对象的原型: '{a}'",
'Extra comma. (it breaks older versions of IE)': '多余的逗号(IE 5\\6\\7 下会报错)',
"Forgotten 'debugger' statement?": "是否忘记了声明'debugger'?",
'Function declarations are not invocable. Wrap the whole function invocation in parens.': '此处是函数声明而不是调用。应该用括号包裹整个函数',
'Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.': '函数的声明不应该放置在块内。应使用函数表达式或将声明语句移到外层函数的顶部',
'get/set are ES5 features.': 'get/set 是ES5的功能',
"Identifier '{a}' is not in camel case.": "标识符'{a}'应该使用驼峰命名法",
'Illegal comma.': '非法的逗号',
'Implied eval. Consider passing a function instead of a string.': 'eval的另一种形式。应该传递函数而不是字符串',
"Incompatible values for the '{a}' and '{b}' linting options.": "'{a}'和'{b}'是不兼容的语法分析选项",
'Inner functions should be listed at the top of the outer function.': '内部函数的声明应该放在外部函数的顶部',
'Input is empty.': '输入为空',
'Input is neither a string nor an array of strings.': '输入是既不是一个字符串,也不是一个字符串数组',
'Invalid element after rest element.': 'rest元素后,不得再写新的元素',
'Invalid for each loop.': '无效的 for each 循环',
'Invalid for-{a} loop left-hand-side: {b}.': 'Invalid for-{a} loop left-hand-side: {b}.',
"Invalid meta property: '{a}.{b}'.": "无效的元素属性' {a}.{b}'.",
'Invalid parameter after rest parameter.': 'rest参数后,不得再写新的参数',
'Invalid regular expression.': '无效正则表达式',
"Invalid typeof value '{a}'": "无效的typeof值 '{a}'",
"It's not necessary to initialize '{a}' to 'undefined'.": "'{a}'不应要初始化为undefined",
'JavaScript URL.': 'JavaScript URL',
"Label '{a}' on {b} statement.": "标签 '{a}' 在 {b} 声明",
"Line breaking error '{a}'.": "换行错误'{a}'",
'Line is too long.': '行超长',
'Math is not a function.': 'Math不是一个函数',
"Missing '()' invoking a constructor.": "使用构造函数时丢掉了'()'",
"Missing ':' on a case clause.": "case语句中丢掉了':'",
"Missing ']' to match '[' from line {a}.": "{a}行的'['缺失了与之匹配的']'",
"Missing 'new' prefix when invoking a constructor.": "使用构造函数时,丢掉了'new'命令",
"Missing '{a}'.": '{a}丢失',
"Missing '}' to match '{' from line {a}.": "{a}行的'{'缺失了与之匹配的'}'",
'Missing "use strict" statement.': '缺少 "use strict"声明',
'Missing name in function declaration.': '声明函数时丢失了函数名',
'Missing property name.': '缺少属性名称',
'Missing radix parameter.': '丢失了基数跟参数,请用`parseInt("10", 10)`形式',
'Missing semicolon.': '缺少分号',
'Mixed double and single quotes.': '不得混用双引号和单引号,请统一',
'Mozilla requires the yield expression to be parenthesized here.': '此处Mozilla要求yield表达要带圆括号',
'null': null,
'Octal literals are not allowed in strict mode.': '严格模式下不允许控制字符{a}',
"Option 'validthis' can't be used in a global scope.": "选项'validthis'不能使用在全局范围内使用",
'Possible strict violation.': '可能违反严格模式',
'Read only.': '只读属性',
"Reassignment of '{a}', which is is a {b}. Use 'var' or 'let' to declare bindings that may change.": "不应为{a}赋值,这是一个{a}应var或'let'来声明才能改变变量值",
"Redefinition of '{a}'.": "重新定义了'{a}'",
'Regular parameters should not come after default parameters.': '常规参数不应该放在定义了默认值的参数之后',
'Script URL.': '不得使用 Script URL',
'Setter is defined without getter.': '定义了Setter,但未定义getter.',
'Stopping.': '正在停止',
'Strict violation.': '违反严格模式',
'Strings must use doublequote.': '字符串必须使用双引号',
'Strings must use singlequote.': '字符串必须使用单引号',
"The '{a}' key may produce unexpected results.": "'{a}'键可能会产生意外的结果",
"The '{a}' option cannot be set after any executable code.": "在选项'{a}'后无法设置任何可执行代码",
"The '{a}' option is only available when linting ECMAScript {b} code.": "选项'{a}'仅可在ECMAScript {b}代码代码中使用",
"The '{a}' property is deprecated.": "'{a}'属性使用了禁用的写法",
'The array literal notation [] is preferable.': '数组应使用[]表示',
'The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.': 'for in的循环体内部,应该包裹一个if判断语句,用以过滤掉从原型中继承的成员',
'The Function constructor is a form of eval.': 'Function的构造函数是eval的另一种形式',
'The object literal notation {} is preferable.': '对象应使用{}表示',
'This character may get silently deleted by one or more browsers.': '这个特征可能会被一个或多个浏览器自动删除',
'This function has too many parameters. ({a})': '此函数的参数过多 ({a})',
'This function has too many statements. ({a})': '此函数的声明过多 ({a})',
"This function's cyclomatic complexity is too high. ({a})": '这个函数的圈复杂度过高。({a})',
'This line contains non-breaking spaces: http://jshint.com/docs/options/#nonbsp': '此行含有“不换行空格”,此种字符由Mac下敲入,有可能造成诡异的bug',
'Too many errors.': '错误过多',
'Unbegun comment.': '开头未关闭的注释',
'Unclosed comment.': '未关闭的注释',
'Unclosed regular expression.': '未关闭的正则表达式',
'Unclosed string.': '未关闭的字符串',
'Unclosed template literal.': '未关闭的模板字符串',
"Unexpected '{a}'.": "意外'{a}'",
"Unexpected /*member '{a}'.": "不用使用 /* 成员 '{a}'",
'Unexpected comma.': '不应该为逗号',
'Unexpected control character in regular expression.': '正则表达式不应使的控制字符',
'Unexpected early end of program.': '意外的过早结束程序',
"Unexpected escaped character '{a}' in regular expression.": "正则表达式中不应使用转义字符'{a}'",
"Unexpected parameter '{a}' in get {b} function.": 'get {b}函数不应该有参数',
"Unexpected use of '{a}'.": "不应该使用'{a}'",
'Unexpected use of a comma operator.': '不应使用逗号操作符',
"Unexpected {a} in '{b}'.": "不该在'{b}'中使用{a}",
"Unmatched '{a}'.": "不匹配的 '{a}'",
'Unnecessary directive "{a}".': "不必要的指令 '{a}'",
'Unnecessary grouping operator.': '不应使用分组操作符',
'Unnecessary semicolon.': '不必要的分号',
"Unreachable '{a}' after '{b}'.": "在'{b}'之后无法访问'{a}'",
'Unrecoverable syntax error.': '不可恢复的语法错误',
"Use '{a}' to compare with '{b}'.": "应利用'{a}' 与 '{b}'比较",
'Use the function form of "use strict".': '应在函数内使用"use strict"',
'Use the isNaN function to compare with NaN.': '应使用isNaN函数来比较NaN',
"Value of '{a}' may be overwritten in IE 8 and earlier.": "变量'{a}'的值可能会在IE(<=8)中被覆盖",
'Variables should not be deleted.': '变量不能被删除',
"Weird construction. Is 'new' necessary?": "奇怪的构造函数。无法确认'new'是否必要的",
'Wrap an immediate function invocation in parens to assist the reader in understanding that the expression is the result of a function, and not the function itself.': '应该用括号包裹立即执行函数以便读者理解表达式是一个函数的结果,而不是函数本身',
'Wrapping non-IIFE function literals in parens is unnecessary.': '不应使用括号包裹非立即执行函数',
'You might be leaking a variable ({a}) here.': '这里可能泄漏一个变量({a})',
'{a} declaration not directly within block.': '{a}不应直接在块内声明',
'{a} may not be supported by non-browser environments.': "'{a}'可能不支持非浏览器环境",
};
module.exports = function (error) {
const message = error.raw && msg[error.raw];
if (message) {
error.message = message.replace(/\{\s*(\w+)\s*\}/g, (s, key) => {
return error[key] || s;
});
}
return error;
};