@frontendfixer/stylelint-config-standard

1.0.1 • Public • Published

@frontendfixer/stylelint-config-standard

npm GitHub Workflow Status (with event) GitHub

Stylelint config with standard rules and useful plugins


Packages included


Usages

Installation

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

{
  "extends": "@frontendfixer/stylelint-config-standard"
}

or you can also put it in your package.json above scripts or higher position

"stylelint": {
    "extends": "@frontendfixer/stylelint-config-standard"
  }

Add script

You can add two scripts to your package.json to lint and/or fix:

"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
  2. Now we need to setup some VS Code settings via Code/FilePreferencesSettings. 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:
// 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
},

Package Sidebar

Install

npm i @frontendfixer/stylelint-config-standard

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

5.56 kB

Total Files

5

Last publish

Collaborators

  • frontendfixer