Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

vite-plugin-stylelint

ModyQyW225.2kMIT6.0.0TypeScript support: included

Stylelint plugin for Vite.

stylelint, vite-plugin

readme

vite-plugin-stylelint

English | 简体中文

介绍

Vite Stylelint 插件。支持 Vite v2 ~ v6 和 Stylelint v13 ~ v16。要求 node>=18

👇 请查看文档了解具体用法和示例。

Cloudflare Pages

你也可能想要 Vite ESLint 插件

安装

npm install vite-plugin-stylelint -D

vite-plugin-stylelint 不会为你安装和配置 Stylelint。你应该自己处理这些。

<summary>Stylelint v16</summary>
npm install stylelint@^16 -D
<summary>Stylelint v15</summary>
npm install stylelint@^15 -D
<summary>Stylelint v14</summary>
npm install stylelint@^14 -D
<summary>Stylelint v13</summary>
npm install stylelint@^13 @types/stylelint@^13 -D

使用

// vite.config.ts
import { defineConfig } from "vite";
import stylelint from "vite-plugin-stylelint";

export default defineConfig({
  plugins: [stylelint()],
});

👇 请查看文档了解具体用法和示例。

Cloudflare Pages

致谢

最初从 gxmari007/vite-plugin-eslint 分叉出来。

贡献者们

该项目由 ModyQyW 创建。

感谢 所有贡献者 的付出!

赞助

如果这个包对你有所帮助,请考虑 赞助 支持,这将有利于项目持续开发和维护。

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

6.0.0 (2024-11-26)

Note: Version bump only for package monorepo

6.0.0-beta.2 (2024-11-08)

Bug Fixes

  • correct id & filePath params (9c78976) - by @

6.0.0-beta.1 (2024-10-19)

Note: Version bump only for package monorepo

6.0.0-beta.0 (2024-10-14)

⚠ BREAKING CHANGES

  • remove chokidar, introduce another way to handle imported style files

Features

  • remove chokidar, introduce another way to handle imported style files (17f3d5d) - by @ModyQyW

Bug Fixes

  • fix wrong colorize (55eb4c3) - by @ModyQyW
  • remove extra parsing (68906c1) - by @ModyQyW
  • stylelintInstance may not be initialized when calling lintFiles in the worker (2caf01c) - by @ModyQyW
  • terminate worker if possible (acd43ca) - by @ModyQyW

5.3.1 (2023-12-19)

  • fix: remove linterResult spread to avoid annoying warnings

5.3.0 (2023-12-09)

  • feat: support stylelint@16

5.2.1 (2023-11-17)

  • chore: update peerDependencies

5.2.0 (2023-10-23)

  • feat: support rollup@4 and vite@5, ATTENTION: rollup@4 is supported since `vite@5.0.0-beta.10`

5.1.1 (2023-08-23)

  • fix: fix wrong ignored when enable chokidar

5.1.0 (2023-08-21)

5.0.1 (2023-08-21)

I want to publish 5.1.0 but sorry 😅

  • feat: add test option

5.0.0 (2023-08-16)

I completely rewrote the plugin. It's still backward compatible, but there is still a possibility that the changes may affect some projects. So I bumped a major version.

  • feat: add lintDirtyOnly option
  • feat: add debug
  • types: add descriptions
  • docs: update README
  • feat!: update internal functions

4.3.0 (2023-03-09)

  • feat: export more types

4.2.0 (2023-02-10)

  • build: switch to unbuild
  • feat: support stylelint@15
  • feat: improve types

4.1.8 (2023-01-31)

  • fix: fix worker initial and close

4.1.7 (2023-01-30)

  • fix: use __dirname directly by accident
  • build: update minify and generate sourcemap

4.1.6 (2023-01-10)

  • perf: better emit handling

4.1.5 (2023-01-04)

  • build: switch to rollup
  • fix: lint some files twice or more

4.1.4 (2022-12-27)

  • fix: fix judge order

4.1.3 (2022-12-16)

  • perf: remove extra console
  • perf: worker message params

4.1.2 (2022-12-16)

  • fix: fix wrong customPrint color

4.1.1 (2022-12-16)

  • perf: internal function params

4.1.0 (2022-12-16)

  • feat: add lintInWorker option
  • perf: output syntax
  • perf: internal function params
  • perf: chokidar initial judgement

4.0.4 (2022-12-14)

  • perf: improve code

4.0.3 (2022-12-14)

  • fix: fix build

4.0.2 (2022-12-13)

  • fix: fix build

4.0.1 (2022-12-11)

  • fix: correct reading stylelint instance

4.0.0 (2022-12-09)

  • feat: support vite@4
  • feat!: require node>=14.18
  • feat!: build option defaults to false
  • feat!: cacheLocation option defaults to .stylelintcache
  • feat: esm by default
    • don't be afraid as commonjs is also supported

3.3.3 (2022-12-05)

  • perf: improve output syntax

3.3.2 (2022-12-04)

  • fix: fix Stylelint options lost

3.3.1 (2022-12-02)

  • fix: fix wrong behavior when enable lintOnStart and chokidar
  • perf: split print, contextPrint and customPrint functions
  • perf: split pluginName variable
  • perf: improve naming

3.3.0 (2022-11-29)

  • feat: add chokidar option

3.2.0 (2022-11-28)

  • feat: add dev and build options

3.1.1 (2022-11-26)

  • fix: fix build

3.1.0 (2022-11-25)

  • refactor
  • feat: add formatter option

3.0.10 (2022-11-25)

  • revert: revert perf: reduce dependencies, which breaks vite@2

3.0.9 (2022-11-24)

  • perf: reduce dependencies

3.0.8

  • fix: fix build

3.0.7

  • perf: use config.cacheDir to get default cacheLocation

3.0.6

  • fix: pass ctx to lintFiles method

3.0.5

  • fix: warning styles

3.0.4

  • perf: warn when lintOnStart is true

3.0.3

  • perf: import path from node:path instead of path
  • fix: fix type: "module" support

3.0.2

Just update peerDependencies in package.json.

3.0.1

  • fix: fix type

3.0.0

This version supports vite@2 and vite@3. The breaking changes are caused by aligning behaviors with Stylelint Node.js API.

  • feat!: remove throwOnError and throwOnWarning options (marked as deprecated before)
  • feat!: include and exclude options now accept string | string[] only to align with stylelint.lint
  • feat: add lintOnStart option
  • feat: exclude virtual: by default

2.3.1

  • fix: show error message when importing stylelint if possible
  • fix: include shims into dist

2.3.0

  • feat: support vite@3
  • feat: ignore virtual modules
  • perf: not to add build.outDir into exclude
  • fix: fix then handling

2.2.3

2.2.2

  • fix: remove allowSyntheticDefaultImports and esModuleInterop in tsconfig.json, closes #5

2.2.1

  • fix: try to fix warning output
  • fix: fix regressions

2.2.0

  • feat: include .svelte files by default

2.1.0

  • perf: better output format
  • feat: add emitErrorAsWarning and emitWarningAsError options

2.0.2

  • fix: fix index.html dealing

2.0.1

  • fix: fix FilterPattern type may be lost

2.0.0

  • feat: bring back throwOnError and throwOnWarning

The plugin recommends emitError / emitWarning instead of throwOnError / throwOnWarning now. However, you can stay with throwOnError / throwOnWarning safely. This is actually a backward-compatible version update.

2.0.0-beta.0

  • feat: support Stylelint options

Breaking Changes

  • throwOnError -> emitError
  • throwOnWarning -> emitWarning

1.3.0-beta.1

  • fix: cacheLocation use relative path

1.3.0-beta.0

  • feat: add stylelintPath option

1.2.0

  • feat: add cacheLocation option
  • fix: fix script

1.1.3

  • perf: minify dist by default
  • fix: stricter include
  • fix: ignore index.html <style>
  • fix: fix vue example scripts
  • chore: update workflow

1.1.2

1.1.1

1.1.1-beta.0

  • fix: Fix internal parameter passing, closes #1
  • chore: add package.json exports

1.1.0

  • feat: support .styl by default
  • perf: remove useless code
  • chore: remove workflow

1.0.4

  • fix: fix import

1.0.3

  • Merge remote-tracking branch 'upstream/main'

1.0.2

  • chore: update example
  • chore: update tsconfig

1.0.1

  • chore: update package.json keywords

1.0.0

Initial release.