Comments (8)
Hmm... are your imported files not run through less lint as well? Wouldn't they fail upstream or downstream?
from grunt-lesslint.
Our architecture is that we have one main less files with a bunch of partials that get imported. It's not practical to lint the partials themselves because they use variables from a separate partial, and cause false positives about missing variables.
So we only lint the main file, and add the partials directory to the imports: []
config. Without caching, this works very well, including giving us accurate line numbers for linting errors in the partials. With caching on, it will ignore changes in the partials if there is no change in the main less file, and will miss any linting errors that are introduced after the cache is primed.
from grunt-lesslint.
So, essentially we'd have to change the cache key of the file from just that files contents to its contents and any imports contents. I'll investigate and see what the impact is on speed.
from grunt-lesslint.
This is proving to be tricky, I can build a naive solution that just parses the less into css every time and then uses the css as a cache key but that doesn't really improve performance as much as now because the less parsing is what we're trying to avoid.
Ideally, I think we'd do a regex match for import statements, grab their file contents (keep the file contents around for later lookups from other less that import it), add all the contents together as hash key.
The problems I foresee with this are relative path resolution vs passing in less options with import lookup paths.
I'm going to punt for now and probably push up something that parses every time since there is a risk of false positive cache hits right now.
from grunt-lesslint.
Your idea sounds good, but I can imagine how it would be tricky. To start with, you'd have to recursively regex match all @import
'ed less files for more @import
s to build a complete set for hashing, right?
What about this: Read the less imports: []
option and hash the complete result set. Then compare that hash every time. It wouldn't have awareness of what files were used by the primary less files, and as a result would invalidate the cache when unrelated files changed, but it would eliminate false positive cache hits and still make things quicker for people doing most of their work in their primary less files instead of in their partials. This would only be necessary when the imports: []
array is non-empty, of course.
from grunt-lesslint.
@cvn just to update on this, plan to go with your strategy of hashing the imports: []
(and possibly caching the hash based on all the names of the import globbed files). Don't really have an ETA but if I can find time today I'll do it.
from grunt-lesslint.
The intermediate fix has landed in 0.19.0.
from grunt-lesslint.
Very cool. Thanks, @jgable
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
- Imported files aren't linted HOT 21
- 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.