ecomfe / node-lesslint Goto Github PK
View Code? Open in Web Editor NEWLess lint
Less lint
.class{
li:last-child {
color: #fff;
}
li:hover {
color: #fff;
}
.class {
color: #fff;
}
}
格式化后对于嵌套下的伪类的冒号后也会加空格,导致less编译失败
格式化错误可能原因:把标签选择器后跟伪类误以为是属性名后跟属性值在冒号后加入了空格,希望做进一步判断
我在开发atom插件时遇到一个问题,
代码 https://github.com/ecomfe/node-lesslint/blob/master/lib/LesslintVisitor.js#L270
this._visitor = new tree.visitor(this); // 加断点tree.visitor is undefined
我并不认为以下代码能加载依赖模块 less/lib/less/visitor.js
https://github.com/ecomfe/node-lesslint/blob/master/lib/LesslintVisitor.js#L9
var tree = require('less/lib/less/tree');
在atom运行环境中,很显然visitor.js 没有加载进来。
我将代码作了一些调整,
将https://github.com/ecomfe/node-lesslint/blob/master/lib/LesslintVisitor.js#L9 改为如下:
var tree = require('less/lib/less/visitor');
然后再less/lib/less/visitor.js模块中导出tree 模块
程序可顺利运行!!
也许你不了解atom运行环境,但是麻烦解释下,less/lib/less/visitor 模块是如何被依赖进来的?
这个bug也只有插件发布的时候会出现,开发中不出现,很诡异!!!!期待回复~
目前对于有多种私有前缀的属性,是不是还不支持检测?
{
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
安装时fecs的提示
npm WARN deprecated [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
查了下依赖,是依赖less的版本过低了,less已经用4以上了
.foo {
.transition(width 1s);
.size(30px, 20px);
.clearfix();
}
Lesslint v1.0.1 执行检查结果:
fecs WARN → line 2, col 26: Must contain spaces before the `{`
fecs WARN → line 3, col 22: Must contain spaces before the `{`
fecs WARN → line 4, col 16: Must contain spaces before the `{`
fecs WARN → line 3, col 5: When multiple selectors share a statement block, each selector statement must be per line
判断语法需要针对Mixin做进一步处理
没看到lesslint的license,想拿来用不过可能需要改一改,请问可以fork否?
PS: 公司内部使用。
.foo {
margin: -10px;
color: red;
}
results in the following output
edp INFO asset/less/ours/foobar.less
edp WARN → CssSyntaxError: TypeError: Cannot read property 'type' of undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.