1 | # @ascendancyy/vue-cli-plugin-stylelint
|
2 |
|
3 | > stylelint plugin for vue-cli
|
4 |
|
5 | ## Injected commands
|
6 |
|
7 | - **`vue-cli-service lint:style`**
|
8 |
|
9 | ```
|
10 | Usage: vue-cli-service lint:style [options] [...files]
|
11 |
|
12 | Options:
|
13 |
|
14 | --no-fix do not auto-fix errors
|
15 | --options list additional stylelint cli options
|
16 | ```
|
17 |
|
18 | Lints and fixes files. If no specific files are given, it lints all vue files, html files, and stylesheets in `src`.
|
19 |
|
20 | ## Configuration (stylelint.config.js, .stylelintrc[.*])
|
21 |
|
22 | Lint on (re)build with `stylelint-webpack-plugin` can be enabled with the `lintStyleOnBuild` option in `vue.config.js`:
|
23 |
|
24 | ``` js
|
25 | module.exports = {
|
26 | // ...
|
27 | pluginOptions: {
|
28 | lintStyleOnBuild: true
|
29 | }
|
30 | }
|
31 | ```
|
32 |
|
33 | ## Installing in an already created project
|
34 |
|
35 | ```
|
36 | npm install -D @ascendancyy/vue-cli-plugin-stylelint
|
37 | vue invoke @ascendancyy/vue-cli-plugin-stylelint
|
38 | ```
|
39 |
|
40 | > There is also a shorthand to invoke the plugin
|
41 | > `vue invoke @ascendancyy/stylelint`
|
42 |
|
43 | ## webpack-chain Injections
|
44 |
|
45 | - `config.plugin('stylelint')`
|
46 | - `config.plugin('stylelint').use('stylelint-webpack-plugin')`
|
47 | - `config.plugin('friendly-errors').tap(/* Adds additional transformer and formatter */)`
|