-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from gucong3000/eclint_i18n
eclint i18n
- Loading branch information
Showing
11 changed files
with
41 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
const messages = new Map([ | ||
[/^invalid charset: (.+?), expected: (.+?)$/, '错误的文件编码:$1,期望:$2'], | ||
[/^expected charset: (.+?)$/, '期望的文件编码:$1'], | ||
[/^character out of latin1 range: (.+?)$/, '超出latin1编码范围的字符:$1'], | ||
|
||
[/^invalid newline: (.+?), expected: (.+?)$/, '错误的缩进尺寸:$1,期望:$2'], | ||
|
||
[/^invalid indent size: (\d+), expected: (\d+)$/, '错误的缩进尺寸:$1,期望:$2'], | ||
|
||
['invalid indent style: found a leading space, expected: tab', '错误的缩进风格:使用了空格,期望:tab'], | ||
['invalid indent style: found a leading tab, expected: space', '错误的缩进风格:使用了tab,期望:空格'], | ||
[/^invalid indent style: found (\d+) soft tab\(s\)$/, '错误的缩进风格:发现$1个软缩进'], | ||
[/^invalid indent style: found (\d+) hard tab\(s\)$/, '错误的缩进风格:发现$1个硬缩进'], | ||
|
||
['expected final newline', '期望结尾换行'], | ||
['unexpected final newline', '不许结尾换行'], | ||
|
||
[/^invalid line length: (\d+), expected: (\d+)$/, '错误的行长度:$1,期望:$2以内'], | ||
|
||
['trailing whitespace found', '行尾禁用空白'], | ||
]); | ||
module.exports = function(error) { | ||
for (const [en, cn] of messages) { | ||
if (en instanceof RegExp) { | ||
if (en.test(error.message)) { | ||
error.message = cn.replace(/\$\d+/, key => en[key]); | ||
return error; | ||
} | ||
} else if (error.message === en) { | ||
error.message = cn; | ||
return error; | ||
} | ||
} | ||
return error; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ class JSHintError extends LintError { | |
|
||
// 报错插件 | ||
plugin: 'JSHint', | ||
name: 'JSHint', | ||
|
||
}, error); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters