Important
This plugin has been deprecated in favor of
vite-plugin-checker
. Please refer to its' documentation to learn how to setup the stylelint check.
Stylelint plugin for vite. Supports autofixing & lints only the files imported in your project. See the example
directory to check Vue / React usage.
npm install @frsource/vite-plugin-stylelint --save-dev
# or
yarn add @frsource/vite-plugin-stylelint --dev
import { defineConfig } from 'vite';
import stylelintPlugin from '@frsource/vite-plugin-stylelint';
export default defineConfig({
plugins: [stylelintPlugin({ /** Options */ })],
});
Apart from the standard Stylelint options this plugin can be configured using the ones below:
- Type:
boolean
- Default:
false
Auto fix the source code.
- Type:
string | string[]
- Default:
['src/**/*.css', 'src/**/*.less', 'src/**/*.styl', 'src/**/*.scss', 'src/**/*.sass', 'src/**/*.vue']
A single file, or array of files, to include when linting.
- Type:
string | string[]
- Default:
'node_modules'
A single file, or array of files, to exclude when linting.
- Type:
string | Stylelint.FormatterType
- Default:
'string'
Custom error formatter or the name of a built-in Styleling formatter, defaults to 'string'
.
- Type:
boolean
- Default:
true
Should the warnings found be emitted, defaults to true.
- Type:
boolean
- Default:
true
Whether errors found should be emitted to console & stop the build, defaults to true.
- Type:
boolean
- Default:
true
Decrease execution time by enabling Stylelint cache. Defaults to true.
- Type:
string
- Default:
'<cwd>/node_modules/.vite/@frsource-vite_plugin-stylelint'
Path for the cache, defaults to '<cwd>/node_modules/.vite/@frsource-vite_plugin-stylelint'
.
This project is using yarn version 3. Make sure to use yarn set version latest
to download it before doing any changes.
MIT