onedesign / generator-one-base

A foundation for One Design Company projects on the web.
Other
1 stars 1 forks source link

Feature/Style Linting #104

Closed cmalven closed 6 years ago

cmalven commented 6 years ago

Adds linting of our SCSS via stylelint

The majority of the changes in this PR aren't actually related to adding this linting to the build, but are related to updating existing CSS in the generator to pass the new linting rules.

I've gone through and handpicked specific rules from the many available options, but we may want to have a conversation about it.

I also highly recommend that everyone install a stylelint plugin for their text editor. I have the SublimeLinter version installed for Sublime Text and it works great.

Next step is ideal to get Prettier added to this as well to automatically fix the most common issues, but that will be a separate PR.

cmalven commented 6 years ago

Update: I tried adding Prettier to this PR, and got it working pretty easily, but I don't think using it is going to be a good idea. Prettier (or at least the postcss parser that Prettier uses for formatting) is way too opinionated, and opinionated in a way that often makes things worse. It's making changes to things that it has no business changing, like removing empty lines where they make the code more clear and drastically changing the way multi-line blocks of code are formatted.

I think the better next step would probably be to figure out how to get Stylelint's autofix working, since it's much more configurable, and would mean using just one style linter instead of two. Unfortunately, gulp-stylelint doesn't currently make it very easy to use the fix option, so that'll have to be a future PR.