Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

culur/stylelint-config

Repository files navigation

@culur/stylelint-config

Culur's config for Stylelint.

Features

Extends

Custom Syntax

Because Stylelint no longer includes parsers (for scss, vue...) this config will use the overrides property to config the following syntaxes if needed.

Auto detect environment

The config is smart enough to detect the environment automatically.

  • If you've installed sass or dart-sass or node-sass, the config will load the stylelint-scss plugin and its configurations.

  • If you've installed tailwindcss:

    • The rule at-rule-no-unknown will ignore all Tailwind CSS's Directives.
    • The rule order/order (from stylelint-order) will be modified from stylelint-config-hudochenkov/order to our custom to make it can work with Tailwind CSS.
  • If you've installed vue, the config will extends stylelint-config-recommended-vue.

Dependencies

This config bundles the following packages, you don't need to install them yourself anymore

  • postcss-html
  • postcss-sass
  • postcss-scss
  • stylelint-config-html
  • stylelint-config-hudochenkov
  • stylelint-config-prettier
  • stylelint-config-standard
  • stylelint-config-standard-scss
  • stylelint-config-standard-vue
  • stylelint-order
  • stylelint-scss

Install

Add @culur/stylelint-config dependency to your project.

# Using npm
npm install @culur/stylelint-config --save-dev

# Using yarn
yarn add @culur/stylelint-config --dev

Usage

If you've installed @culur/stylelint-config locally within your project, Just set your stylelint config to:

{
  "extends": ["@culur/stylelint-config"]
}

If you've globally installed @culur/stylelint-config using the -g flag, then you'll need to use the absolute path to @culur/stylelint-config in your config e.g.

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

Scripts

Some commonly used scripts in package.json.

{
  "scripts": {
    "fix:css": "stylelint **/*.{vue,tsx,css,scss} --allow-empty-input --fix",
    "test:css": "stylelint **/*.{vue,tsx,css,scss} --allow-empty-input"
  }
}

Related

Stylelint

Library

  • Tailwind CSS - A utility-first CSS framework for rapid UI development.
  • VueJS - An approachable, performant and versatile framework for building web user interfaces.

Configuration

Syntaxes

Plugins

  • Stylelint Order - A plugin pack of order related linting rules for stylelint.
  • Stylelint SCSS - A collection of SCSS specific linting rules for stylelint.