@frsource/vite-plugin-stylelint
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.
Install
npm install @frsource/vite-plugin-stylelint --save-dev
# or
yarn add @frsource/vite-plugin-stylelint --dev
Usage
import { defineConfig } from 'vite';
import stylelintPlugin from '@frsource/vite-plugin-stylelint';
export default defineConfig({
plugins: [stylelintPlugin({ /** Options */ })],
});
Options
Apart from the standard Stylelint options this plugin can be configured using the ones below:
fix
- Type:
boolean
- Default:
false
Auto fix the source code.
include
- 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.
exclude
- Type:
string | string[]
- Default:
'node_modules'
A single file, or array of files, to exclude when linting.
formatter
- Type:
string | Stylelint.FormatterType
- Default:
'string'
Custom error formatter or the name of a built-in Styleling formatter, defaults to 'string'
.
throwOnWarning
- Type:
boolean
- Default:
true
Should the warnings found be emitted, defaults to true.
throwOnError
- Type:
boolean
- Default:
true
Whether errors found should be emitted to console & stop the build, defaults to true.
cache
- Type:
boolean
- Default:
true
Decrease execution time by enabling Stylelint cache. Defaults to true.
cacheLocation
- 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'
.
Development
This project is using yarn version 3. Make sure to use yarn set version latest
to download it before doing any changes.
License
MIT