Uh oh!
There was an error while loading. Please reload this page.
Add stylelint - #1216
Conversation
facebook-github-bot
commented
Dec 9, 2016
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact cla@fb.com if you have any questions. |
facebook-github-bot
commented
Dec 9, 2016
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Or you could use a Sass linter for both SASS and SCSS syntax! |
stylelint also supports CSS-like syntaxes like SCSS, SugarSS and Less. This is however not relevant for The |
karlhorky
commented
Dec 18, 2016
webpack/stylelint-webpack-plugin#43 has been merged and released as |
There was a problem hiding this comment.
@karlhorky I recommend another update here to capture our fixes from this morning (v0.4.2).
gaearon
commented
Feb 12, 2017
Can you provide some details about node_modules disk size before and after this change please? Also, would this work well for people compiling Sass/Less into CSS, and importing the compiled CSS? Does this plugin work well with Webpack 2? |
9bff79c to
afbb7f7Compare
109M node_modules # before
122M node_modules # after
It could lint the original source Sass/Less if I changed the file extensions that are matched by the plugin. I however only enable linting of source files (disabling the linting of any built CSS files) because the built output will be optimized and is thus not a good candidate for linting.
I tested this with a simple application and the plugin works. As for working well, I haven't tested extensively yet - maybe @JaKXz can offer some insight here? |
I've modified the Edit: This appears to be resolved in |
The plugin is actively tested against webpack 2 as of webpack/stylelint-webpack-plugin#46, so I have confidence in the logic against webpack's compiler [from v0.5.0 on]. |
gaearon
commented
Feb 13, 2017
The scenario I meant is when people compile Sass to CSS but keep it in |
karlhorky
commented
Feb 13, 2017
Ah yeah, that would also be supported by changing the file extensions. |
There was a problem hiding this comment.
one thing to consider is that stylelint can handle .sass/.scss files, and the default glob for stylelint-webpack-plugin supports both so you could drop this line.
There was a problem hiding this comment.
Ah, nice idea. If @gaearon agrees we want to go this direction, I will make this change.
karlhorky
commented
Feb 15, 2017
shai32
commented
Apr 14, 2017
Is this PR still active?, will it be merged? |
karlhorky
commented
Apr 14, 2017
If there's any interest I can rebase and fix conflicts (and upgrade to webpack 2 if necessary). |
roytz
commented
Apr 14, 2017
There is much interest :) (and to the upgrade to webpack 2 too) |
cr101
commented
Apr 15, 2017
Handling |
shai32
commented
Apr 25, 2017
@karlhorky please upgrade to webpack 2 |
shai32
commented
May 2, 2017
Is this pr active? |
karlhorky
commented
Jan 10, 2018
gaearon
commented
Jan 10, 2018
Lol I'm sorry 😛 |
karlhorky
commented
Jan 11, 2018
Ok, I'll get to this in the next day or so. |
gaearon
commented
Jan 12, 2018
I'd also like to better understand the performance implications of this. If the project has e.g. 500 300-line CSS files, how much does this plugin affect the development and production build times? People already complain about the builds being super slow so I'm not really sure we have the capacity to add any more build-time work. |
727f487 to
43bbaf0ComparePerhaps this should be opt-in like some others in #3815? I think the FYI v0.10.1 of the plugin was released recently as well as stylelint v8. |
This seems a bit trickier. We won't make those opt-in by some configuration flag. Instead if you import |
JaKXz
commented
Jan 17, 2018
I think the intention here is to have stylelint errors side by side with eslint errors in the build, and assuming CRA works with the better errors webpack plugin that should be achievable :) but I understand your point, I agree it's much harder to pinpoint exactly what the user would want from the outset, and that could change with a lot more volatility. |
gaearon
commented
Jan 20, 2018
Retagging as 2.x because I don't think this should block the 2.0 release. If it slows down our already slow builds I don't think we can do this (but you can always use it separately in your IDE etc). |
caghand
commented
Jan 22, 2018
Yes, you can use stylelint in your IDE, but since the errors do not appear in the build output (like eslint), you won't be able to implement a check-in policy that prevents style-violating CSS from being pushed in. :) -Caghan |
sstruct
commented
Feb 9, 2018
I'd prefer Prettier |
| rules: { | ||
| 'at-rule-no-unknown': true, | ||
| 'color-no-invalid-hex': true, | ||
| 'declaration-block-no-duplicate-properties': true, |
There was a problem hiding this comment.
Wouldn't be better to use declaration-block-no-duplicate-properties with ignore: ["consecutive-duplicates"]?
Moreover, is this rule blocks the pattern of (Added example)?
margin: 1rem;
margin-bottom: 2rem;
ai
commented
Sep 26, 2018
If we have ESLint for JS, we definitely should have Stylelint for CSS. |
Hi there! First of all, thanks to all the contributors for this awesome project. Having all the tools, configuration and setup in one place helps tons.
create-react-appdoesn't have any CSS linting yet. I noticed that there was tentative agreement for further consideration in #636 (comment), so I decided to open a PR for this, since I need it for a project anyway.I've included the standard config because I don't have a full opinionated
stylelintconfig yet, but this can of course be changed.Note: This depends on my fork of @vieron's stylelint webpack plugin, because the errors were not displaying correctly using watch mode in CRA. I've opened a pull request on the plugin here: webpack/stylelint-webpack-plugin#43Edit: Pull request has been merged!