1.1.0 • Published 2 days ago

kifor-stylelint-config v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

kifor-stylelint-config

npm version Build Status Downloads per month

Created by Kifor Kostiantyn

This is the standard configuration file for stylelint from Kifor Kostiantyn.

Use it as is or as a basis for your own configuration.

Installation

Along with the config, install the stylelint itself.

npm i -D kifor-stylelint-config stylelint

Usage

In the root of the project, create a .stylelintrc file and in it add kifor-stylelint-config to the extends field.

.stylelintrc

{
  "extends": "kifor-stylelint-config"
}

If you set kifor-stylelint-config globally with the -g flag, then you need to use the absolute path kifor-stylelint-config in the configuration file:

.stylelintrc

{
  "extends": "/absolute/path/to/kifor-stylelint-config"
}

Configure extension

You can override existing rules or add new ones.

To do this, add a rules field to the config with the desired rule overrides.

.stylelintrc

{
  "extends": "kifor-stylelint-config",
  "rules": {
    "property-no-unknown": [
      true,
      {
        "ignoreProperties": [
          "composes"
        ]
      }
    ],
    "unit-whitelist": ["em", "rem", "s", "px"]
  }
}

In the same rules field, you can also override the no longer supported Stylelint styleguide rules from the stylelint-codeguide plugin by adding the prefix codeguide/ before the rule name.

.stylelintrc

{
  "extends": "kifor-stylelint-config",
  "rules": {
    "property-no-unknown": [
      true,
      {
        "ignoreProperties": [
          "composes"
        ]
      }
    ],
    "unit-whitelist": ["em", "rem", "s", "px"],

    "codeguide/indentation": "tab",
    "codeguide/number-leading-zero": null
  }
}

Usage in VSCode

  1. Install stylelint and config
  2. Open VSCode
  3. Install the stylelint plugin
  4. Use it

Inconsistencies with the config rules are underlined with a red wavy line, hovering over it will bring up a popup with the error description.