1.3.3 • Published 9 months ago

@culur/config-stylelint v1.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@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 config will check whether the following packages are installed or not to change plugins and rules.

EnvironmentPackages
Tailwindtailwindcss
SCSSsass or dart-sass or node-sass
Vuevue

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.

ConfigTailwindSassVue
@culur/config-stylelintautoautoauto
@culur/config-stylelint/autoautoautoauto
@culur/config-stylelint/none
@culur/config-stylelint/sass-vuetruetrue
@culur/config-stylelint/sasstrue
@culur/config-stylelint/tailwind-sass-vuetruetruetrue
@culur/config-stylelint/tailwind-sasstruetrue
@culur/config-stylelint/tailwindtrue
@culur/config-stylelint/vuetrue

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: true,
    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).

1.3.3

9 months ago

1.3.2

9 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.0

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.5

10 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

1 year ago

0.0.0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago