Comparing version 0.1.14 to 0.1.15
@@ -43,2 +43,5 @@ /** | ||
var lineContent = util.getLineContent(lineNum, me.fileData, true); | ||
// 不去掉开头空格的 lineContent,目的是和 lineContent 的长度做比较,算出 lineContent 的缩进 | ||
var lineContent1 = util.getLineContent(lineNum, me.fileData); | ||
var spacesNum = selector.selectorLevel * 4; | ||
@@ -59,2 +62,3 @@ var reg; | ||
line: lineNum, | ||
col: lineContent.length - lineContent1.length + 1, | ||
message: '`' | ||
@@ -92,2 +96,6 @@ + lineContent | ||
var lineContent = util.getLineContent(lineNum, me.fileData, true); | ||
// 不去掉开头空格的 lineContent,目的是和 lineContent 的长度做比较,算出 lineContent 的缩进 | ||
var lineContent1 = util.getLineContent(lineNum, me.fileData); | ||
var spacesNum; | ||
@@ -114,2 +122,3 @@ if (realVal.selectors) { | ||
line: lineNum, | ||
col: lineContent.length - lineContent1.length + 1, | ||
message: '`' | ||
@@ -116,0 +125,0 @@ + lineContent |
@@ -35,3 +35,3 @@ /** | ||
lastLineNumCache = -1; | ||
// lastLineNumCache = -1; | ||
@@ -42,27 +42,25 @@ selectors.forEach( | ||
var curLineNum = util.getLine(elem.index, fileData); | ||
var lineContent = util.getLineContent(curLineNum, fileData); | ||
if (lastLineNumCache !== curLineNum) { | ||
lastLineNumCache = curLineNum; | ||
// if (!/^[^\{]+(\s)\{$/g.test(lineContent)) { | ||
if (/^([^\{]*)[^\s]\{$/g.test(lineContent)) { | ||
me.invalidList.push({ | ||
uniqueFlag: ruleName + curLineNum, | ||
ruleName: ruleName, | ||
line: curLineNum, | ||
message: '`' | ||
+ lineContent | ||
+ '` ' | ||
+ msg, | ||
colorMessage: '`' | ||
+ lineContent.replace( | ||
'{', | ||
chalk.magenta('{') | ||
) | ||
+ '` ' | ||
+ chalk.grey(msg) | ||
}); | ||
} | ||
var lineContent = util.getLineContent(curLineNum, fileData, true); | ||
var match = lineContent.match(/[^\{]*[^\s](\{)$/); | ||
if (match) { | ||
var inputStr = match[0]; | ||
var matchStr = match[1]; | ||
me.invalidList.push({ | ||
uniqueFlag: ruleName + curLineNum + inputStr + matchStr, | ||
ruleName: ruleName, | ||
line: curLineNum, | ||
col: lineContent.indexOf(matchStr) + 1, | ||
message: '`' | ||
+ lineContent | ||
+ '` ' | ||
+ msg, | ||
colorMessage: '`' | ||
+ lineContent.replace( | ||
'{', | ||
chalk.magenta('{') | ||
) | ||
+ '` ' | ||
+ chalk.grey(msg) | ||
}); | ||
} | ||
}); | ||
@@ -69,0 +67,0 @@ } |
{ | ||
"name": "lesslint", | ||
"description": "lint your less code", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"maintainers": [ | ||
@@ -6,0 +6,0 @@ { |
83616
2297