Skip to content
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

Provide integration wit stylelint #207

Closed
vvs opened this issue Aug 31, 2017 · 5 comments
Closed

Provide integration wit stylelint #207

vvs opened this issue Aug 31, 2017 · 5 comments
Labels
enhancement locked Please open a new issue and fill out the template instead of commenting.

Comments

@vvs
Copy link

vvs commented Aug 31, 2017

Now that prettier supports CSS/SCSS formatting, it would be really nice to integrate prettier-vscode with stylelint in a manner similar to what is done with eslint integration for JavaScript files.

Ideally, there should be a config option to enable/disable this integration (just like with eslint), so that the SCSS/CSS styles formatted with prettier are then auto-fixed via stylelint to confirm to stylelint rules.

Stylelint is adding more and more support for its --fix functionality.

Here's one of the use cases I have: The source base I am working on has a stylelint rule that all color HEX values must be uppercase. Prettier formats the HEX values to be lowercase, which breaks stylelint checks.

And since prettier is an 'opinionated' formatter, it doesn't provide a way to configure this behavior.

@CiGit
Copy link
Member

CiGit commented Sep 1, 2017

I'm not sure this would bring something more than only relying on stylelint in this case. Disclaimer: I don't know stylelint.

Is there any project we could start of? (prettier-stylelint, ...)

@vvs
Copy link
Author

vvs commented Sep 1, 2017

@CiGit Stylelint is very simialr to eslint, it checks for common problems in styles, and it also enforces some of the stylistic rules on how to format the CSS/SCSS files.

For the list of stylelint rules, take a look here: https://stylelint.io/user-guide/rules/

The rules that can be fixed by stylelint (--fix option) are marked as Autofixable.

As you see, Stylelint doesn't really reformat the whole files, it mostly does gentle things, like cases, empty lines, indents (some of these options are not available in prettier, which is probably not that bad in common case, but pretty bad in those cases when you are working on big projects and cannot change the rules and force everybody switch to prettier).

Without this prettier/stylelint integration I can't really use prettier (and this plugin in VS Code) in some projects, since the SCSS output prettier produces basically breaks the build due to stylelint errors. With javascript files this is not a problem, since I can rely on prettier-eslint integration to fix the differences.

I am not aware of any current project like prettier-stylelint at the moment.

@hugomrdias
Copy link
Contributor

hugomrdias commented Sep 11, 2017

Working on this, already have a basic version of a prettier-stylelint tool a few more tests and I'll do a PR here adding support for it.

@CiGit
Copy link
Member

CiGit commented Nov 21, 2017

This seems to be done since a long time ...

@CiGit CiGit closed this as completed Nov 21, 2017
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the locked Please open a new issue and fill out the template instead of commenting. label Apr 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement locked Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

3 participants