crabatool 1.0.342 → 1.0.345
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tool/checkjs.js +2 -2
package/package.json
CHANGED
package/tool/checkjs.js
CHANGED
|
@@ -159,13 +159,13 @@ module.exports.start = async function() {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
// trimEnd检查
|
|
162
|
-
var tstr = /\.
|
|
162
|
+
var tstr = /\.trim\(\s*['"]([^'"]){1}['"]\s*\)|\.trimStart\(\s*['"]([^'"]){1}['"]\s*\)|\.trimEnd\(\s*['"]([^'"]){1}['"]\s*\)/g;
|
|
163
163
|
if (tstr.test(content)) {
|
|
164
164
|
var noComment = utils.clearComment(content);// 去掉注释的代码再查一遍;因为js里面有些危险字符是被注释了的
|
|
165
165
|
|
|
166
166
|
// 二次检查
|
|
167
167
|
if (tstr.test(noComment)) {
|
|
168
|
-
var infoList = getMathReuslts(noComment, tstr, null, 'trimEnd(
|
|
168
|
+
var infoList = getMathReuslts(noComment, tstr, null, 'trim(x)或trimEnd(x)或trimStart(x)使用不规范,不支持参数替换;请调整为trimChar(x)或trimEndChar(xx)或trimStartChar(xx)');
|
|
169
169
|
var list = trimErrDatas[filePath];
|
|
170
170
|
if (list) trimErrDatas[filePath] = list.concat(infoList); // 记录该js有异常
|
|
171
171
|
else trimErrDatas[filePath] = infoList;
|