You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,16 +21,40 @@ This plugin uses [`stylelint`](https://stylelint.io/) that helps you avoid error
21
21
22
22
To begin, you'll need to install `stylelint-webpack-plugin`:
23
23
24
-
```bash
24
+
```console
25
25
npm install stylelint-webpack-plugin --save-dev
26
26
```
27
27
28
+
or
29
+
30
+
```console
31
+
yarn add -D install stylelint-webpack-plugin
32
+
```
33
+
34
+
or
35
+
36
+
```console
37
+
pnpm add -D stylelint-webpack-plugin
38
+
```
39
+
28
40
**Note**: You also need to install `stylelint >= 13` from npm, if you haven't already:
29
41
30
-
```bash
42
+
```console
31
43
npm install stylelint --save-dev
32
44
```
33
45
46
+
or
47
+
48
+
```console
49
+
yarn add -D stylelint
50
+
```
51
+
52
+
or
53
+
54
+
```console
55
+
pnpm add -D stylelint
56
+
```
57
+
34
58
**Note**: If you are using Stylelint 13 rather than 14+, you might also need to install `@types/stylelint` as a dev dependency if getting stylelint related type errors.
35
59
36
60
Then add the plugin to your webpack config. For example:
@@ -51,7 +75,12 @@ See [stylelint's options](https://stylelint.io/user-guide/usage/node-api#options
51
75
52
76
### `configFile`
53
77
54
-
- Type: `String`
78
+
- Type:
79
+
80
+
```ts
81
+
typecontext=string;
82
+
```
83
+
55
84
- Default: `undefined`
56
85
57
86
Specify the config file location to be used by `stylelint`.
@@ -60,63 +89,110 @@ Specify the config file location to be used by `stylelint`.
Specify the files and/or directories to exclude. Must be relative to `options.context`.
74
113
75
114
### `extensions`
76
115
77
-
- Type: `String|Array[String]`
116
+
- Type:
117
+
118
+
```ts
119
+
typeextensions=string|Array<string>;
120
+
```
121
+
78
122
- Default: `['css', 'scss', 'sass']`
79
123
80
124
Specify extensions that should be checked.
81
125
82
126
### `files`
83
127
84
-
- Type: `String|Array[String]`
128
+
- Type:
129
+
130
+
```ts
131
+
typefiles=string|Array<string>;
132
+
```
133
+
85
134
- Default: `null`
86
135
87
-
Specify directories, files, or globs. Must be relative to `options.context`. Directories are traveresed recursively looking for files matching `options.extensions`. File and glob patterns ignore `options.extensions`.
136
+
Specify directories, files, or globs. Must be relative to `options.context`. Directories are traversed recursively looking for files matching `options.extensions`. File and glob patterns ignore `options.extensions`.
88
137
89
138
### `fix`
90
139
91
-
- Type: `Boolean`
140
+
- Type:
141
+
142
+
```ts
143
+
typefix=boolean;
144
+
```
145
+
92
146
- Default: `false`
93
147
94
148
If `true`, `stylelint` will fix as many errors as possible. The fixes are made to the actual source files. All unfixed errors will be reported. See [Autofixing errors](https://stylelint.io/user-guide/usage/options#fix) docs.
95
149
96
150
### `formatter`
97
151
98
-
- Type: `String|Function`
152
+
- Type:
153
+
154
+
```ts
155
+
typeformatter=string| (
156
+
results:Array<import('stylelint').LintResult>
157
+
) =>string
158
+
```
159
+
99
160
- Default: `'string'`
100
161
101
162
Specify the formatter that you would like to use to format your results. See [formatter option](https://stylelint.io/user-guide/usage/options#formatter).
102
163
103
164
### `lintDirtyModulesOnly`
104
165
105
-
- Type: `Boolean`
166
+
- Type:
167
+
168
+
```ts
169
+
typelintDirtyModulesOnly=boolean;
170
+
```
171
+
106
172
- Default: `false`
107
173
108
174
Lint only changed files, skip lint on start.
109
175
110
176
### `stylelintPath`
111
177
112
-
- Type: `String`
178
+
- Type:
179
+
180
+
```ts
181
+
typestylelintPath=string;
182
+
```
183
+
113
184
- Default: `stylelint`
114
185
115
186
Path to `stylelint` instance that will be used for linting.
116
187
117
188
### `threads`
118
189
119
-
- Type: `Boolean | Number`
190
+
- Type:
191
+
192
+
```ts
193
+
typethreads=boolean|number;
194
+
```
195
+
120
196
- Default: `false`
121
197
122
198
Set to true for an auto-selected pool size based on number of cpus. Set to a number greater than 1 to set an explicit pool size. Set to false, 1, or less to disable and only run in main process.
@@ -128,42 +204,84 @@ You can still force this behavior by using `emitError` **or** `emitWarning` opti
128
204
129
205
#### `emitError`
130
206
131
-
- Type: `Boolean`
207
+
- Type:
208
+
209
+
```ts
210
+
typeemitError=boolean;
211
+
```
212
+
132
213
- Default: `true`
133
214
134
215
The errors found will always be emitted, to disable set to `false`.
135
216
136
217
#### `emitWarning`
137
218
138
-
- Type: `Boolean`
219
+
- Type:
220
+
221
+
```ts
222
+
typeemitWarning=boolean;
223
+
```
224
+
139
225
- Default: `true`
140
226
141
227
The warnings found will always be emitted, to disable set to `false`.
142
228
143
229
#### `failOnError`
144
230
145
-
- Type: `Boolean`
231
+
- Type:
232
+
233
+
```ts
234
+
typefailOnError=boolean;
235
+
```
236
+
146
237
- Default: `true`
147
238
148
239
Will cause the module build to fail if there are any errors, to disable set to `false`.
149
240
150
241
#### `failOnWarning`
151
242
152
-
- Type: `Boolean`
243
+
- Type:
244
+
245
+
```ts
246
+
typefailOnWarning=boolean;
247
+
```
248
+
153
249
- Default: `false`
154
250
155
251
Will cause the module build to fail if there are any warnings, if set to `true`.
156
252
157
253
#### `quiet`
158
254
159
-
- Type: `Boolean`
255
+
- Type:
256
+
257
+
```ts
258
+
typequiet=boolean;
259
+
```
260
+
160
261
- Default: `false`
161
262
162
263
Will process and report errors only and ignore warnings, if set to `true`.
163
264
164
265
#### `outputReport`
165
266
166
-
- Type: `Boolean|Object`
267
+
- Type:
268
+
269
+
```ts
270
+
typeoutputReport=
271
+
|boolean
272
+
| {
273
+
filePath?:string|undefined;
274
+
formatter?:
275
+
| (
276
+
|string
277
+
| ((
278
+
results:Array<import('stylelint').LintResult>
279
+
) =>string)
280
+
)
281
+
|undefined;
282
+
};
283
+
```
284
+
167
285
- Default: `false`
168
286
169
287
Write the output of the errors to a file, for example a `json` file for use for reporting.
0 commit comments