-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
ROADMAP #2259
Comments
@jeddy3 I realize that most of ^^ means that I'm coming around to your views that I've argued against in the past! 😜 |
Fantastic write up, well thought out and put forward arguments, no objections being CSS only 👍 |
😆 You know I'm going to be in agreement with this proposal :) You articulate the arguments for it very well here and within your blog post.
Yes, and deprecating rules based on this audit.
Agreed.
I agree. Additionally, I think people typically want to specify a subset of CSS features that can be used by their team. The CSS spec is vast, with numerous ways of solving any given problem (e.g. font sizing). Restricting what features are available to a team can greatly improve the consistency of the code base. For clarity's sake, I'll briefly expand on how, and to what extent, we currently fulfil each of these wants...
There are, as outlined in #2079 (comment), 86 formatting rules in stylelint. These laser-focused rules work together to enforce a wide variety of formatting styles. I agree that these formatting styles should be auto-fixed.
We achieve this in stylelint by not enforcing any particular best practices per se, but rather by providing a series of 53 rules to disallow (
We split this into two camps:
I agree that the former is better done via major projects like
Agreed.
SGTM. A lot of this is captured within the
I assume you mean
I agree. We get For We can then focus on exploring the very interesting possibilities of automatic fixes and spec validation for |
What about For example there is a stylesheet which is processed by postcss-simple-vars: a {
$width: 10px;
width: $width;
} This stylesheet processed by default PostCSS parser. |
I think working out the particulars still needs to be done.
It'll probably treat them as declarations and be applied. a {
$width: 10px; /* parsed as delc, treated as declaration */
width: $width; /* parsed as delc, treated as declaration */
--custom-prop: value; /* parsed as decl, treated as custom property */
} Unless, as @davidtheclark suggests, something is used to prepare the code before it enters stylelint and these constructs are removed. What are your thoughts? |
If it will be applied, there should be new ways to achieve the same as now behaviour. There should be plugin with identical logic to new And it's only one rule in my mind. I think there will be more rules, which can potentially hurt users, who use default PostCSS parser and some PostCSS plugins with non-standard syntax. |
Autoformatting tool is great! There few “rules” what will make an autoformatting tool an excellent companion to stylelint:
It would be hard to have formatting tool as a separate project, because of “rules” above. I remember one of the main reasons for keeping stylefmt and stylelint as separate projects were stylelint's core team disinterest in supporting and developing such tool. Now we have at least one core team member with interest in this subject :) I have an example regarding “in sync” rules logic and options. I've released postcss-sorting 2.0 recently and have to add support for Now I have a linter — stylelint without option above, and formatter — postcss-sorting with the option above. I can't lint "at-rule-empty-line-before", but I can already format with this option. It's reversed situation (formatter ahead of linter), but it makes a point. A logic for a linter and formatter should be the same. Otherwise there will be problems: linter has a new option, formatter didn't get this option yet, formatter make changes to style sheet without this option and linter fails. |
One more thing for autoformatter: it should support stylelint plugins somehow. For example, there should be a way to fix |
@jeddy3 Exactly — I was thinking of that as part of "best practices" but I do agree that it's more clear to name those goals separately, since people often think of "best practices" as global rather than particular. After @hudochenkov's comments and some thinking this morning, I have some new ideas. Considering what it would actually take to extract SCSS/Less/SSS exceptions into external tools, and to do that in a way that preserves current functionality — if it's possible at all — I'm worried it would be much, much more work to conduct such an experiment than to stick to the path we're on. The more practical approach might be this:
(Spec validation with css-values or csstree was always going to be a plugin, so it's no problem if that particular plugin just doesn't work for non-standard syntax users.) I worry that @jeddy3's ultra-systematic mind might not be satisfied by such an approach. But don't you agree that the alternative would be a ridiculous amount of work, whereas what we have going now is sustainable, especially if you personally ignore non-standard syntax issues? Anybody who wants to spend time working on css-values can do so; and anybody who wants to spend time working on SCSS bugs can do so. I think that the next focus should be on automatic fixes. All @hudochenkov's goals make sense to me. Another goal to consider is improving performance. There's one big change we could make that I think would make a big difference: Change the rule API so that rules provide callbacks for particular nodes instead of looping through the nodes themselves. Then the function that invokes rules would walk through each type of nodes only once. This would dramatically decreases the number of times we walk through all the nodes of a given type, so ought to improve performance dramatically. Essentially, we'd be doing what PostCSS folks are calling an "event-based API". PostCSS is going to have this at some point, but it seems like it's been in the works for a very long time and might not be delivered for another very long time. We could make our own, and hook it into PostCSS's whenever it's available. This would be quite a bit of work. But there is some consolation:
|
@davidtheclark if I understand correctly, there is a proposal to use module.exports = {
return {
Decls: someValidateFunction()
}
} Am i right? |
@evilebottnawi Yes, same idea. |
@davidtheclark I'm voiting for it, also it will greatly reduce the code and make it more readable |
For me this is a feature I'd really like to see stylelint support properly. I use ESLint's autofixer very often. It is very powerful when you can take any code outside your project and just automatically format it to what ever you have defined in your project.
I really like this idea, because trying to support preprocessors or other syntaxes when autofixing is just a big mess (I've been contributing to stylefmt, and just look at the bugs it has currently).
My current project has almost 20 000 lines of SCSS. Using stylelint in the project is super useful, but switching to use something else than Sass would be a huge task, and something that probably won't happen. Even if Sass has its shortcomings, good parts and bad parts, it is still a good tool when you need to do something like generating CSS using math and loops etc. I don't see extracting SCSS/Less/SSS exceptions into external tools as a bad idea. Surely it requires a lot of work, but it would also mean that For example, if my project would be using using Sass, I could do I'm not sure how this would work if your project is using multiple syntaxes (what would stylelint to if you have both |
@kristerkari I can not imagine how many things we use should moved to the separate package as in many rules we use different checking based on non-standard syntax. The only solution in my eyes is a postprocessor on postcss (call it |
I'd be really happy with such a solution, as well as ready to help if something pops up. Even though we are using stylelint exclusively with scss in about 20 - 30 projects, I've never had the urge to add plugins like stylelint-scss to improve linting. Stylelint already does a great job at linting literally everything that is thrown at it. Just out of curiosity, how do you guys work? Do you use exclusively CSS with PostCSS? |
BTW, i have about 100+ projects and in all i use |
I know that it is a huge effort, but I also doubt that the autofix feature would work that well if stylelint supports multiple, non-standard syntaxes. :/ |
Another thing that may give significant performance gain is caching the results (like in eslint). So, only changed files are passed to linter on subsequent runs. @davidtheclark, what do you think? |
@sergesemashko |
@sergesemashko We'd love any issue/PR suggesting performance improvements! For your idea, how about opening an issue explaining the idea a little more thoroughly, and then we'll discuss and move on to a PR?
@kristerkari I think that this might be one of the main advantages of moving the
@evilebottnawi 😆 It's true: almost everybody uses SCSS. If stylelint is to remain relevant to the typical frontend dev/designer, we can't abandon SCSS.
@nirazul I've been using PostCSS custom properties and custom media queries. I sometimes write Node modules to generate CSS that others might be tempted to implement with Sass loops and mixins and other nonsense. Maybe at some point I'll write a blog post ... |
True. I've borrowed |
I try to be pragmatic sometimes too :) I agree that your approach is the more practical one. I think we're also in agreement that the complexity cost of non-standard constructs/syntax is too high, and that only using standard constructs is where the future of CSS authoring and tooling lies. I think there's an opportunity to clarify stylelint's position on non-standard syntax/constructs. I think this clarification would be especially useful when we come to communicate that new feature (e.g. autofixing) will only be for standard syntax/constructs. In I think this simple change would communicate our vision for adding new features that only support standard constructs/syntax. I think it'll also become easier to communicate that stylelint's core rules are only applicable to standard constructs/syntax by (and this is the important bit) ignoring, rather than tripping-up on non-standard ones. People can continue to contribute fixes (and tests) to stylelint so that non-standard are correctly ignored. I agree that pushing this outside of stylelint's core isn't practical at the moment. From an end user's perspective, the only thing that will change is that they will need to explicitly state that they are using a non-standard syntax (by installing another parser and using the As an aside, I think our decision last year to use whitelisting for standard constructs, rather blacklisting non-standard constructs, for the What do you think? I believe this is just a small twist on, what I feel, is the consensus reached in this discussion. As such, I'm going to write-up a
Yes, I'm much like @davidtheclark.
That would be awesome. |
@jeddy3: On changing the Upside:
(I don't really think the psychological effect you suggest, that this will "clarify stylelint's position" or "communicate our vision", is worth any kind of change. Documentation will be much more effective in conveying such intentions than implicit communication via subtle option changes.) Downsides:
I just don't see it as a change worth making. |
Good points.
Ok, agreed. |
I think we're all on the same page, and sounds like @jeddy3 is interested in working out a |
@stylelint/core @davidtheclark I'm sorry to be late. I think, it's hard for stylefmt team to follow stylelint development speed. So, I have a proposal: May I transfer stylefmt repository to stylelint organization? It seems happy for users and our community. Thanks. |
@morishitter #2096 i think we should to reach a compromise in the future to join forces to build |
@evilebottnawi I see, Thanks :) |
I'd like to chat about the next steps for stylelint. Our 8.0 release will be mostly focused on standardizing option names; and we already had a major release that was mostly about standardizing rule names; so I expect that more standardization like this will not be necessary for quite a while, if ever. We've create a very fine configuration system. So let's think about what might be our next major goals, if any.
First off, I'll say that I personally have lost all sympathy for and interest in non-standard syntax. I am now a hard-line anti-Sass militant: as far as I'm concerned it should be banished from the realm. I am not planning to spend any of my time fixing issues related to non-standard syntax. I've been toying with the idea of forking stylelint to create a much simplified CSS-only version — that's extreme, but the next paragraph shows why.
There are two directions that interest me the most right now:
I agree with the growing opinion in the frontend world (evidence by the immediate popularity of
prettier
for JS) that style format rules are best enforced by an automatic fixer rather than a linter. I might say that I'm interested, then, in contributing to stylefmt — but I'm discouraged by the idea of getting involved in another project that is going to be poisoned by non-standard syntaxes. Just as I have an inclination to fork stylelint to create a CSS-only linter, I have an inclination to fork stylefmt to create a CSS-only formatter.Spec validation would involve contributing to css-values or csstree and their stylelint plugins. These important tools are another reason to hate Sass its kin: these projects will be hindered, stalled, even derailed if they try to accommodate non-standard syntax completely.
My interests in the above come from belief that there are 3 things people typically want from a code quality tool:
These priorities make me very, very inclined to steer away from non-standard syntaxes. I could just step back, as mentioned above, and hope that others who are not so hostile will take charge of handling anything non-standard-syntax-related issues. But actually I'm revisiting @jeddy3's idea in #1749 , that we offload all handling of non-standard syntax, push it out of stylelint. This could be v9.
I'm not thinking we should try to create another AST format that is stylelint-compatible — that seems like more than necessary — but that we should extract our accumulated code and knowledge into tools that prepare code before it enters stylelint, and offer those up to the non-standard syntax communities to maintain. Maybe stylelint's formatters would work for this purpose: the
scss-formatter
takes SCSS code and transforms it into code that stylelint can read, just as themarkdown-formatter
takes markdown code and transforms it into code that stylelint can read. The more I think about this, the more I like the idea.I'm not sure what to do about stylefmt. @morishitter what are your thoughts about non-standard syntax and the future of stylefmt? Are you worried that supporting non-standard syntax will hurt the project, and do you have any interest in dropping support? Or if I want to work on a CSS-only formatter, should I fork stylefmt?
Thoughts @stylelint/core?
The text was updated successfully, but these errors were encountered: