@smoothie-css/stylelint-config
v0.3.0
Published
Smoothie's recommended Stylelint configuration
Downloads
17
Readme
← Back to Smoothie 🍹
Stylelint Config
Setup
- Install both Stylelint and the Smoothie Config
npm i --save-dev stylelint @smoothie-css/stylelint-config
- Load the configuration object in your preferred format and add the following to the top of your file:
{ "extends": [ "@smoothie-css/stylelint-config" ], ... }
- Run the following command to lint your CSS with the Stylelint config:
You could also set this as an npmstylelint '**/*.css'
script
within your project'spackage.json
:
in this example, running via"scripts": { "lint:css": "stylelint '**/*.css'" }
npm run lint:css
Mixing Syntax
If you're using different syntax to write styles in your project, you may have to separate out your configs.
For example, let's say you're using vanilla CSS and Styled Components (CSS-in-JS library):
Create a new
.stylelint
directory in your project, with two JSON config files (one for each):.stylelint ├── css.json └── styled-components.json
Follow the previous setup steps to
extend
Smoothie's config in both files.Note: For the majority of CSS-in-JS libraries that use tagged template literals, you'll need to make use of
stylelint-processor-styled-components
.Set-up a script for each tool, with one that runs both:
"scripts": { "lint:css": "stylelint '**/*.css' --config .stylelint/css.json", "lint:styled-components": "stylelint '**/*.js' --config .stylelint/styled-components.json", "lint": "npm run lint:css && npm run lint:styled-components" }