-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[Feature Request] Build a Less linter that uses the Less parser (Rebuild the parser) #2099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm afraid this basically means "write a new parser for Less". Currently neither parser nor the syntax tree it generates support "saving whitespaces" so you'd have to rewrite almost everything from scratch to achieve this. |
I was looking for something like this as well .. a less style checker would be valuable in a large project. |
Could this feature be considered for a bigger update, such as the upcoming 2.0.0 version? I feel this is quite important for the LESS community. SASS has such a code style linter tool already: scss-lint |
You wouldn't have to rewrite the parser. On the 2 branch I was thinking Anyway, I don't quite know how to do it, but I'd like to think it's |
Adding my interest in this to the thread. I was considering using the SUIT preprocessor instead of LESS specifically because of its Rework-based conformance checker. The possibility of building such custom tools is very appealing. |
I'd love to collaborate in any effort to get this going. My ultimate goal would be to develop a linter for LESS that allows pluggable rules, a la eslint. |
@anshumanf Welcome :), it would be useful thing. Did you started somewhere and do you need some concrete help? |
I've been working on a pluggable PostCSS-powered linter: https://github.com/stylelint/stylelint. I wonder how it might work for Less. We've been working a little bit already with non-standard syntax features (e.g. nesting) --- but they have to be syntax features that don't make PostCSS error --- and I think that many possibilities will open up after @ai enables custom syntaxes in PostCSS ... Just something to consider, maybe experiment with, if anyone's interested. |
@SomMeri It's early days yet. So far I'm still figuring out the LESS parser and my plan of attack. Will try to get back with something concrete soon. I'm glad to see there is still interest for this. :) |
Yeap, next release PostCSS branch already can replace a parser. I think we will have a basis SCSS and Less parsers in next month. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Re-opening this as there's still ongoing interest for a Less-based linter. - See: microsoft/vscode#43087 and especially this comment: microsoft/vscode#43087 (comment) I've been doing experimental work from time to time on a Less parser replacement which could possibly help with linting (and preserving whitespace) eventually - https://github.com/matthew-dean/less.js/blob/experiments/parser/lib/less/parser/grammar.ne |
@matthew-dean But for linting in editor, your parser needs to be
|
@octref I agree that (integrating with Stylelint) should probably be the short-term solution for VSCode. |
@matthew-dean Does that mean you are planning to build something better for Less specifically? 😛 |
@octref Ha, me specifically? No, I'm mostly focused on bug-fixing & new Less features right now. I've done some parsing / linting explorations, and am talking to someone about taking on that work, so the most I'd probably be involved in something like that is either in helping manage or coordinate the work. |
I am looking for a tool for LESS that does what
node-jscs
does for JavaScript. It would be useful on project with large teams to enforce a code style throughout the LESS files. I could not find any such tool on npm.I guess the only technical aspect blocking one from using the LESS Parser from this package to build such a tool is that the Parser discards all whitespace information when building the tree. Otherwise, if one were to build a code style tool one would have to write a new parser for LESS.
I propose an optional setting for the Parser that would make it save the whitespace information in the tree.
Hopefully others out there would use such a tool (LESS code style checker).
The text was updated successfully, but these errors were encountered: