@culur/config-stylelint

1.4.8 • Public • Published

@culur/config-stylelint

NPM Version NPM Download NPM License

CodeFactor Codecov Build and release

Sharing Stylelint configurations.

✨ Features

The library is a shareable Stylelint configuration. It has some key features as follows:

Auto detect environment

The configuration will check if the following packages are installed and their versions to change plugins and rules.

Environment Packages Support versions
Tailwind tailwindcss 0, 1, 2, 3, 4
SCSS sass or dart-sass or node-sass -
Vue vue -

Extends

💿 Installation

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

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

# Using pnpm
pnpm install @culur/config-stylelint --dev

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

Other packages:

  • Use need to install stylelint package in devDependencies.

📖 Usage

1. Extending config

Set your .stylelintrc.json to:

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

Below are also some pre-built configs to use.

Config Tailwind Sass Vue
@culur/config-stylelint auto auto auto
@culur/config-stylelint/auto auto auto auto
@culur/config-stylelint/none
@culur/config-stylelint/sass-vue true true
@culur/config-stylelint/sass true
@culur/config-stylelint/tailwind3-sass-vue 3 true true
@culur/config-stylelint/tailwind3-sass 3 true
@culur/config-stylelint/tailwind3 3
@culur/config-stylelint/tailwind4-vue 4 true
@culur/config-stylelint/tailwind4 4
@culur/config-stylelint/vue true

2. Define config

You can also define which environments are enabled via the defineConfig function.

// .stylelintrc.mjs
import { defineConfig } from '@culur/config-stylelint/factory';

export default defineConfig(
  {
    tailwind: 4,
    sass: false,
    vue: false,
  },
  {
    extends: [],
    plugins: [],
    rules: {},
  },
);

Note: When using defineConfig function, you must install stylelint-config-* and plugins dependencies to your project.

2. Ignoring Code

Stylelint use .stylelintignore file to ignore specific files. You can use the following command to copy our default .stylelintignore to your project root folder:

# unix
cp "node_modules\@culur\config-stylelint\.stylelintignore" ".stylelintignore"

# windows
copy "node_modules\@culur\config-stylelint\.stylelintignore" ".stylelintignore"

📜 Scripts

Some commonly used scripts in package.json.

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

🗃️ Changelog

See CHANGELOG for more information on what has changed recently.

🔒 License

See LICENSE for license rights and limitations (MIT).

Readme

Keywords

Package Sidebar

Install

npm i @culur/config-stylelint

Weekly Downloads

35

Version

1.4.8

License

MIT

Unpacked Size

439 kB

Total Files

153

Last publish

Collaborators

  • phamhongphuc