krds / lesslint Goto Github PK
View Code? Open in Web Editor NEWLESS files linter
LESS files linter
/.dialog {
display: none;
}/
Thrown Error: Closing bracket must be on its own line
A block of code skips the validation for the whole file.
Download it here: http://we.tl/ICo0DRgAQG
I have a freaking issue i can't manage to solve and thus need more brain juices.
I have the following style.less file:
.f{background: url(t.png); padding: 0; border: 0; width: 0px; height: 0px;}
.skewX(){
}
Lesslint returns no error, despite there are errors :
*line 1:
- Closing bracket must be on its own line
- No need to specify units when a value is 0
- One property per line max
- Use one space before an opening bracket: {
line 4:
- Use one space before an opening bracket: {
- This line should be indented with 2 tabs
line 6, This line should be indented with 1 tab
It is because in this case _escapeNonEndOfLineSemicolon returns NULL and "clear" all content to validate so of course there is no error with an empty file.
The issue is with the pattern used:
#\((?:(?:.*)(;)(?:.*))*\)#e
Test code:
$content = '.f{background: url(t.png); padding: 0; border: 0; width: 0px; height: 0px;}';
var_dump(preg_match('#\((?:(?:.*)(;)(?:.*))*\)#', $content));
=> bool(false) (wut?) :
Now removes any of the padding/border/height property:
.f{background: url(t.png); padding: 0; border: 0; height: 0px;}
.skewX(){
}
=> works, leesslint finds errors.
$content = '.f{background: url(t.png); padding: 0; border: 0; height: 0px;}';
var_dump(preg_match('#\((?:(?:.*)(;)(?:.*))*\)#', $content));
=> int(0) (wut?²)
You can try with another propery after background with the same result.
I'm unable to figure out the issue, looks like an internal php bug.
What is the purpose of _escapeNonEndOfLineSemicolon ?
My test:
php /usr/local/webtools/lesslint/lesslint-fix.php /usr/local/webtools/lesslint/test/rules.json /home/server/htdocs/projects/tests/test-ksimonst/tk/public/assets/front/css/style.less
Because we need to skip rules for just a code part:
/* LessLint:ignore */
myRule{
}
/* /LessLint:ignore */
.keyframes(~'animationName, 0%{ transform: scale(1.5); color: blue; } 100%{ transform: scale(2); color: red }');
As we have to write all keys & CSS properties in one single string for this mixin, LESSlint blocking commit with following errors:
Thrown errors => Closing bracket must be on its own line
=> No need to specify units when a value is 0
Suggested by @RajaramUI
.icon {
&:extend(.sprite);
display: none;
}
Thrown Error: Colon should have no space before, and one after. at line => &:extend(.sprite);
lesslint rules.json /path/to/less/folder/ /path/to/file.less
--exclude=file.less,lib.less
--recursive
I don't understand the last 2 args. Are the 2 mandatory? Can I just indicate one (folder OR file?)
Thanks
Kevin89
As we commit these hex codes, Its throwing an error that "No units for 0 value"
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.