https://github.com/frontendfixer/-frontendfixer-stylelint-config-standard
https://github.com/frontendfixer/-frontendfixer-stylelint-config-standard
css sass scss stylelint stylelint-config stylelint-scss
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/frontendfixer/-frontendfixer-stylelint-config-standard
- Owner: frontendfixer
- License: mit
- Created: 2023-07-22T13:39:02.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T15:50:49.000Z (almost 2 years ago)
- Last Synced: 2025-01-04T10:56:03.189Z (4 months ago)
- Topics: css, sass, scss, stylelint, stylelint-config, stylelint-scss
- Language: CSS
- Homepage: https://github.com/frontendfixer/-frontendfixer-stylelint-config-standard#readme
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @frontendfixer/stylelint-config-standard
  
Stylelint config with standard rules and useful plugins
---
## Packages included
- plugins
- [stylelint-scss](https://github.com/stylelint-scss/stylelint-scss)
- Config Extended
- [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard)
- [stylelint-config-standard-scss](https://github.com/stylelint/stylelint-config-standard-scss)
- [stylelint-config-css-modules](https://github.com/pascalduez/stylelint-config-css-modules)
- [stylelint-config-recess-order](https://github.com/stormwarning/stylelint-config-recess-order)
- [postcss-scss](https://github.com/postcss/postcss-scss)---
## Usages
### Installation
```bash
yarn add -D postcss^8.4.27 stylelint^15.10.2 @frontendfixer/stylelint-config-standard```
### Configuration
Create a Stylelint config file with `.stylelintrc` or `.stylelintrc.json` and put this lint
```json
{
"extends": "@frontendfixer/stylelint-config-standard"
}
```or you can also put it in your `package.json` above scripts or higher position
```json
"stylelint": {
"extends": "@frontendfixer/stylelint-config-standard"
}
```### Add script
You can add two scripts to your package.json to lint and/or fix:
```json
"scripts": {
"lint": "stylelint '**/*.{css,scss}'",
"lint:fix": "stylelint '**/*.{css,scss}' --fix",
},
```- Now you can manually lint your code by running `yarn run lint` and fix all fixable issues with `yarn run lint:fix`. You probably want your editor to do this though.
### Auto fix lint error with VSCode
You should read this entire thing. Serious!
Once you have done one, or both, of the above installs. You probably want your editor to lint and fix for you. Here are the instructions for VS Code:
1. Install the [vscode-stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
2. Now we need to setup some VS Code settings via `Code/File` → `Preferences` → `Settings`. It's easier to enter these settings while editing the `settings.json` file, so click the Open (Open Settings) icon in the top right corner:```js
// disable the built-in CSS, Less, and SCSS linters:
"css.validate": false,
"scss.validate": false,
// enable stylelint
"stylelint.validate": ["css", "scss"],
// tell the Stylelint plugin to run on save
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
},
```