Comments (21)
From the README:
By default, this plugin does not include any lint errors from imported files in the output.
You can enable this by adding an imports configuration option:
from grunt-lesslint.
@jgable I did read that. My understanding is that imported files are not linted by default, but that including an imports array under options will result in such files being linted. I've referenced an imports glob and imported files still are not linted. What am I missing?
from grunt-lesslint.
Can you post an example that is not working that you feel should be?
from grunt-lesslint.
lesslint: {
options: {
imports: [
'src/less/**/*.less',
'src/pages/**/*.less',
'src/features/**/*.less',
'bower_components/charter-ui/src/**/*.less'
],
csslint: {
csslintrc: '.csslintrc'
}
},
src: [
'src/pages/*/*.less',
'src/less/<%= pkg.name %>.less'
]
}
from grunt-lesslint.
Hmm...now that I've pasted it on Github for all the world to see, that doesn't look quite right...
from grunt-lesslint.
Updated to this, still no dice:
lesslint: {
options: {
csslint: {
csslintrc: '.csslintrc'
}
},
build: {
src: [
'src/pages/*/*.less',
'src/less/<%= pkg.name %>.less'
],
imports: [
'src/less/**/*.less',
'src/pages/**/*.less',
'src/features/**/*.less'
]
}
}
from grunt-lesslint.
Imports must be an option in the options
hash. And it's kind of odd that you have your src
files are also in your imports
files.
lesslint: {
options: {
csslint: {
csslintrc: '.csslintrc'
}
},
build: {
src: [
'src/pages/*/*.less',
'src/less/<%= pkg.name %>.less'
],
options: {
imports: [
'src/less/**/*.less',
'src/pages/**/*.less',
'src/features/**/*.less',
'bower_components/charter-ui/src/**/*.less'
]
}
}
}
from grunt-lesslint.
Still no dice. In this project, each page is a single page app, so we'll have a page.less
file that simply imports from subfolders, such as pulling in widgets/my-widget.less
. So everything is in the same directory.
I've placed an error in the first included file in one of my primary page less files. If that same error is in the less file itself, it gets flagged. In the import, no flag. However, if I remove code from the import that the calling file depends on, lesslint knows about it. So the files are being read, I'm just not receiving any warnings.
from grunt-lesslint.
We have a unit test that covers this specific case, and it is still passing. I'm gonna need to see an example repo setup that reproduces this to dig any deeper.
from grunt-lesslint.
Alright, I'll put something together and post in a bit. Thanks for taking the time.
from grunt-lesslint.
Here ya go - just install and run the task:
https://github.com/serquhart/serquhart-test-lesslint
The variable definition from the imported file is observed, but the error is overlooked. All rules are turned off except ie6/7 star hack, and the hack is used in the imported file.
from grunt-lesslint.
I see an error:
Running "lesslint:build" (lesslint) task
src/page.less (1)
Property with star prefix found. Checks for the star property hack (targets IE6/7) (star-property-hack)
>> src/page/feature.less [Line 4, Column 3]: *height: 100px;
>> 1 lint error in 1 file.
Warning: Task "lesslint:build" failed. Use --force to continue.
Aborted due to warnings.
What is your node version, lessc version and all that? Have you run npm update in your project?
from grunt-lesslint.
Node: 0.10.31
Lesslint: 1.1.10
Yes, updated. Does lesslint require node 0.10.32?
from grunt-lesslint.
No, I'm on 0.10.28. I also just tried it on 0.10.31 and it also produced
the same error when running grunt lesslint
I have no idea what is going on for you but it sounds like an environment
issue.
from grunt-lesslint.
Are there any known issues for lesslint on windows? Running windows 8.1.
from grunt-lesslint.
Not sure. Don't have anything running windows to test with.
from grunt-lesslint.
Interesting development - the error from the imported file does show up in generated reports, but the cli shows 0 errors.
from grunt-lesslint.
So here's the moral of the story: lesslint's messages.filter
creates a stripped version of each less file's path, and all have a preceding slash. Those paths are then compared to the import glob patterns provided in the Gruntfile, and if those patterns don't also have a preceding slash, it's considered a mismatch.
'my/pattern/**/*.less' != '/my/pattern/what/ever.less'
This seems to only affect Windows (go figure). I'll be submitting a PR to fix soon.
from grunt-lesslint.
Warning: Task "lesslint:src" failed.� Use --force to continue.
node version > v0.10.33
lesslint version: 1.1.13
from grunt-lesslint.
ERROR
in less-lint-task.js
return queue.drain = function() {
writeToFormatters(options, results);
if (errorCount === 0) {
grunt.log.ok("" + fileCount + " " + (grunt.util.pluralize(fileCount, 'file/files')) + " lint free.");
return done();
} else {
grunt.log.writeln();
grunt.log.error("" + errorCount + " lint " + (grunt.util.pluralize(errorCount, 'error/errors')) + " in " + fileCount + " " + (grunt.util.pluralize(fileCount, 'file/files')) + ".");
return done(false);
}
};
errorCount ever is > 0 when the less have issue
i change the return on else to return done(true) and works
from grunt-lesslint.
@vianch this is a closed issue, and it's not clear that your problem is associated. I'd suggest opening a new issue.
from grunt-lesslint.
Related Issues (20)
- NPM package should be named 'grunt-contrib-lesslint' HOT 4
- DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. HOT 1
- Please read the question from closed issue #53
- Possiblity to mute certain errors? HOT 3
- Getting errors from imports without specifying the imports HOT 7
- Way to rewrite import rules HOT 3
- Comments in .csslintrc HOT 3
- Load options through the .csslintrc file in the current working directory HOT 2
- Import Statement leads to Parse Error HOT 3
- Change to using grunt in js instead of coffee HOT 4
- Update less to 2.5.x? HOT 1
- I can't get lesslint to honor newer HOT 1
- Not Validating HOT 13
- Add support for showing lint warnings HOT 2
- Would like to add imports before parsing HOT 1
- [Question] Dislay multiple errors per file HOT 1
- Update dependencies HOT 1
- Is it possible to ignore lines? HOT 1
- parsing error: Cannot read property 'lineNumber' of undefined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-lesslint.