stylelint-webpack-plugin 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright JS Foundation and other contributors
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- 'Software'), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright JS Foundation and other contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ 'Software'), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,197 +1,199 @@
1
- <div align="center">
2
- <a href="https://github.com/stylelint/stylelint"><img width="200" height="200" src="https://cdn.worldvectorlogo.com/logos/stylelint.svg"></a>
3
- <a href="https://github.com/webpack/webpack"><img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg"></a>
4
- </div>
5
-
6
- [![npm][npm]][npm-url]
7
- [![node][node]][node-url]
8
- [![deps][deps]][deps-url]
9
- [![tests][tests]][tests-url]
10
- [![coverage][cover]][cover-url]
11
- [![chat][chat]][chat-url]
12
- [![size][size]][size-url]
13
-
14
- # stylelint-webpack-plugin
15
-
16
- > A Stylelint plugin for webpack
17
-
18
- ## Install
19
-
20
- ```bash
21
- npm install stylelint-webpack-plugin --save-dev
22
- ```
23
-
24
- **Note**: You also need to install `stylelint` from npm, if you haven't already:
25
-
26
- ```bash
27
- npm install stylelint --save-dev
28
- ```
29
-
30
- ## Usage
31
-
32
- In your webpack configuration:
33
-
34
- ```js
35
- const StylelintPlugin = require('stylelint-webpack-plugin');
36
-
37
- module.exports = {
38
- // ...
39
- plugins: [new StylelintPlugin(options)],
40
- // ...
41
- };
42
- ```
43
-
44
- ## Options
45
-
46
- See [stylelint's options](http://stylelint.io/user-guide/node-api/#options) for the complete list of options available. These options are passed through to the `stylelint` directly.
47
-
48
- ### `configFile`
49
-
50
- - Type: `String`
51
- - Default: `undefined`
52
-
53
- Specify the config file location to be used by `stylelint`.
54
-
55
- **Note:** By default this is [handled by `stylelint`](http://stylelint.io/user-guide/configuration/).
56
-
57
- ### `context`
58
-
59
- - Type: `String`
60
- - Default: `compiler.context`
61
-
62
- A string indicating the root of your files.
63
-
64
- ### `exclude`
65
-
66
- - Type: `String|Array[String]`
67
- - Default: `['node_modules', compiler.options.output.path]`
68
-
69
- Specify the files and/or directories to exclude. Must be relative to `options.context`.
70
-
71
- ### `extensions`
72
-
73
- - Type: `String|Array[String]`
74
- - Default: `['css', 'scss', 'sass']`
75
-
76
- Specify extensions that should be checked.
77
-
78
- ### `files`
79
-
80
- - Type: `String|Array[String]`
81
- - Default: `null`
82
-
83
- 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`.
84
-
85
- ### `fix`
86
-
87
- - Type: `Boolean`
88
- - Default: `false`
89
-
90
- 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/cli#autofixing-errors) docs.
91
-
92
- ### `formatter`
93
-
94
- - Type: `String|Function`
95
- - Default: `'string'`
96
-
97
- Specify the formatter that you would like to use to format your results. See [formatter option](https://stylelint.io/user-guide/node-api#formatter).
98
-
99
- ### `lintDirtyModulesOnly`
100
-
101
- - Type: `Boolean`
102
- - Default: `false`
103
-
104
- Lint only changed files, skip lint on start.
105
-
106
- ### `stylelintPath`
107
-
108
- - Type: `String`
109
- - Default: `stylelint`
110
-
111
- Path to `stylelint` instance that will be used for linting.
112
-
113
- ### `threads`
114
-
115
- - Type: `Boolean | Number`
116
- - Default: `false`
117
-
118
- 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.
119
-
120
- ### Errors and Warning
121
-
122
- **By default the plugin will auto adjust error reporting depending on stylelint errors/warnings counts.**
123
- You can still force this behavior by using `emitError` **or** `emitWarning` options:
124
-
125
- #### `emitError`
126
-
127
- - Type: `Boolean`
128
- - Default: `false`
129
-
130
- The errors found will always be emitted, to disable set to `false`.
131
-
132
- #### `emitWarning`
133
-
134
- - Type: `Boolean`
135
- - Default: `false`
136
-
137
- The warnings found will always be emitted, to disable set to `false`.
138
-
139
- #### `failOnError`
140
-
141
- - Type: `Boolean`
142
- - Default: `false`
143
-
144
- Will cause the module build to fail if there are any errors, to disable set to `false`.
145
-
146
- #### `failOnWarning`
147
-
148
- - Type: `Boolean`
149
- - Default: `false`
150
-
151
- Will cause the module build to fail if there are any warnings, if set to `true`.
152
-
153
- #### `quiet`
154
-
155
- - Type: `Boolean`
156
- - Default: `false`
157
-
158
- Will process and report errors only and ignore warnings, if set to `true`.
159
-
160
- #### `outputReport`
161
-
162
- - Type: `Boolean|Object`
163
- - Default: `false`
164
-
165
- Write the output of the errors to a file, for example a `json` file for use for reporting.
166
- The `filePath` is relative to the webpack config: `output.path`.
167
- You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used.
168
-
169
- ```js
170
- {
171
- filePath: 'path/to/file';
172
- formatter: 'json';
173
- }
174
- ```
175
-
176
- ## Changelog
177
-
178
- [Changelog](CHANGELOG.md)
179
-
180
- ## License
181
-
182
- [MIT](./LICENSE)
183
-
184
- [npm]: https://img.shields.io/npm/v/stylelint-webpack-plugin.svg
185
- [npm-url]: https://npmjs.com/package/stylelint-webpack-plugin
186
- [node]: https://img.shields.io/node/v/stylelint-webpack-plugin.svg
187
- [node-url]: https://nodejs.org
188
- [deps]: https://david-dm.org/webpack-contrib/stylelint-webpack-plugin.svg
189
- [deps-url]: https://david-dm.org/webpack-contrib/stylelint-webpack-plugin
190
- [tests]: https://github.com/webpack-contrib/stylelint-webpack-plugin/workflows/stylelint-webpack-plugin/badge.svg
191
- [tests-url]: https://github.com/webpack-contrib/stylelint-webpack-plugin/actions
192
- [cover]: https://codecov.io/gh/webpack-contrib/stylelint-webpack-plugin/branch/master/graph/badge.svg
193
- [cover-url]: https://codecov.io/gh/webpack-contrib/stylelint-webpack-plugin
194
- [chat]: https://badges.gitter.im/webpack/webpack.svg
195
- [chat-url]: https://gitter.im/webpack/webpack
196
- [size]: https://packagephobia.now.sh/badge?p=stylelint-webpack-plugin
197
- [size-url]: https://packagephobia.now.sh/result?p=stylelint-webpack-plugin
1
+ <div align="center">
2
+ <a href="https://github.com/stylelint/stylelint"><img width="200" height="200" src="https://cdn.worldvectorlogo.com/logos/stylelint.svg"></a>
3
+ <a href="https://github.com/webpack/webpack"><img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg"></a>
4
+ </div>
5
+
6
+ [![npm][npm]][npm-url]
7
+ [![node][node]][node-url]
8
+ [![deps][deps]][deps-url]
9
+ [![tests][tests]][tests-url]
10
+ [![coverage][cover]][cover-url]
11
+ [![chat][chat]][chat-url]
12
+ [![size][size]][size-url]
13
+
14
+ # stylelint-webpack-plugin
15
+
16
+ > A Stylelint plugin for webpack
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm install stylelint-webpack-plugin@2 --save-dev
22
+ ```
23
+
24
+ **Note**: You also need to install `stylelint` from npm, if you haven't already:
25
+
26
+ ```bash
27
+ npm install stylelint --save-dev
28
+ ```
29
+
30
+ **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.
31
+
32
+ ## Usage
33
+
34
+ In your webpack configuration:
35
+
36
+ ```js
37
+ const StylelintPlugin = require('stylelint-webpack-plugin');
38
+
39
+ module.exports = {
40
+ // ...
41
+ plugins: [new StylelintPlugin(options)],
42
+ // ...
43
+ };
44
+ ```
45
+
46
+ ## Options
47
+
48
+ See [stylelint's options](http://stylelint.io/user-guide/node-api/#options) for the complete list of options available. These options are passed through to the `stylelint` directly.
49
+
50
+ ### `configFile`
51
+
52
+ - Type: `String`
53
+ - Default: `undefined`
54
+
55
+ Specify the config file location to be used by `stylelint`.
56
+
57
+ **Note:** By default this is [handled by `stylelint`](http://stylelint.io/user-guide/configuration/).
58
+
59
+ ### `context`
60
+
61
+ - Type: `String`
62
+ - Default: `compiler.context`
63
+
64
+ A string indicating the root of your files.
65
+
66
+ ### `exclude`
67
+
68
+ - Type: `String|Array[String]`
69
+ - Default: `['node_modules', compiler.options.output.path]`
70
+
71
+ Specify the files and/or directories to exclude. Must be relative to `options.context`.
72
+
73
+ ### `extensions`
74
+
75
+ - Type: `String|Array[String]`
76
+ - Default: `['css', 'scss', 'sass']`
77
+
78
+ Specify extensions that should be checked.
79
+
80
+ ### `files`
81
+
82
+ - Type: `String|Array[String]`
83
+ - Default: `null`
84
+
85
+ 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`.
86
+
87
+ ### `fix`
88
+
89
+ - Type: `Boolean`
90
+ - Default: `false`
91
+
92
+ 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/cli#autofixing-errors) docs.
93
+
94
+ ### `formatter`
95
+
96
+ - Type: `String|Function`
97
+ - Default: `'string'`
98
+
99
+ Specify the formatter that you would like to use to format your results. See [formatter option](https://stylelint.io/user-guide/node-api#formatter).
100
+
101
+ ### `lintDirtyModulesOnly`
102
+
103
+ - Type: `Boolean`
104
+ - Default: `false`
105
+
106
+ Lint only changed files, skip lint on start.
107
+
108
+ ### `stylelintPath`
109
+
110
+ - Type: `String`
111
+ - Default: `stylelint`
112
+
113
+ Path to `stylelint` instance that will be used for linting.
114
+
115
+ ### `threads`
116
+
117
+ - Type: `Boolean | Number`
118
+ - Default: `false`
119
+
120
+ 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.
121
+
122
+ ### Errors and Warning
123
+
124
+ **By default the plugin will auto adjust error reporting depending on stylelint errors/warnings counts.**
125
+ You can still force this behavior by using `emitError` **or** `emitWarning` options:
126
+
127
+ #### `emitError`
128
+
129
+ - Type: `Boolean`
130
+ - Default: `false`
131
+
132
+ The errors found will always be emitted, to disable set to `false`.
133
+
134
+ #### `emitWarning`
135
+
136
+ - Type: `Boolean`
137
+ - Default: `false`
138
+
139
+ The warnings found will always be emitted, to disable set to `false`.
140
+
141
+ #### `failOnError`
142
+
143
+ - Type: `Boolean`
144
+ - Default: `false`
145
+
146
+ Will cause the module build to fail if there are any errors, to disable set to `false`.
147
+
148
+ #### `failOnWarning`
149
+
150
+ - Type: `Boolean`
151
+ - Default: `false`
152
+
153
+ Will cause the module build to fail if there are any warnings, if set to `true`.
154
+
155
+ #### `quiet`
156
+
157
+ - Type: `Boolean`
158
+ - Default: `false`
159
+
160
+ Will process and report errors only and ignore warnings, if set to `true`.
161
+
162
+ #### `outputReport`
163
+
164
+ - Type: `Boolean|Object`
165
+ - Default: `false`
166
+
167
+ Write the output of the errors to a file, for example a `json` file for use for reporting.
168
+ The `filePath` is relative to the webpack config: `output.path`.
169
+ You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used.
170
+
171
+ ```js
172
+ {
173
+ filePath: 'path/to/file';
174
+ formatter: 'json';
175
+ }
176
+ ```
177
+
178
+ ## Changelog
179
+
180
+ [Changelog](CHANGELOG.md)
181
+
182
+ ## License
183
+
184
+ [MIT](./LICENSE)
185
+
186
+ [npm]: https://img.shields.io/npm/v/stylelint-webpack-plugin/2x.svg
187
+ [npm-url]: https://npmjs.com/package/stylelint-webpack-plugin/v/2x
188
+ [node]: https://img.shields.io/node/v/stylelint-webpack-plugin/2x.svg
189
+ [node-url]: https://nodejs.org
190
+ [deps]: https://david-dm.org/webpack-contrib/stylelint-webpack-plugin.svg
191
+ [deps-url]: https://david-dm.org/webpack-contrib/stylelint-webpack-plugin
192
+ [tests]: https://github.com/webpack-contrib/stylelint-webpack-plugin/workflows/stylelint-webpack-plugin/badge.svg?branch=2.x
193
+ [tests-url]: https://github.com/webpack-contrib/stylelint-webpack-plugin/actions
194
+ [cover]: https://codecov.io/gh/webpack-contrib/stylelint-webpack-plugin/branch/2.x/graph/badge.svg
195
+ [cover-url]: https://codecov.io/gh/webpack-contrib/stylelint-webpack-plugin/branch/2.x
196
+ [chat]: https://badges.gitter.im/webpack/webpack.svg
197
+ [chat-url]: https://gitter.im/webpack/webpack
198
+ [size]: https://packagephobia.now.sh/badge?p=stylelint-webpack-plugin
199
+ [size-url]: https://packagephobia.now.sh/result?p=stylelint-webpack-plugin
@@ -8,7 +8,7 @@ export default function getStylelint(
8
8
  key: string | undefined,
9
9
  { threads, ...options }: Options
10
10
  ): Linter;
11
- export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
11
+ export type Stylelint = import('postcss').PluginCreator<
12
12
  import('stylelint').PostcssPluginOptions
13
13
  > & {
14
14
  lint: (
@@ -48,11 +48,9 @@ export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
48
48
  options: {
49
49
  ruleName: string;
50
50
  ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
51
- root: import('stylelint/node_modules/postcss').Root;
51
+ root: import('postcss').Root;
52
52
  },
53
- callback: (
54
- warning: import('stylelint/node_modules/postcss').Warning
55
- ) => void
53
+ callback: (warning: import('postcss').Warning) => void
56
54
  ) => void;
57
55
  };
58
56
  };
@@ -14,7 +14,7 @@ export default function linter(
14
14
  report: Reporter;
15
15
  threads: number;
16
16
  };
17
- export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
17
+ export type Stylelint = import('postcss').PluginCreator<
18
18
  import('stylelint').PostcssPluginOptions
19
19
  > & {
20
20
  lint: (
@@ -54,11 +54,9 @@ export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
54
54
  options: {
55
55
  ruleName: string;
56
56
  ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
57
- root: import('stylelint/node_modules/postcss').Root;
57
+ root: import('postcss').Root;
58
58
  },
59
- callback: (
60
- warning: import('stylelint/node_modules/postcss').Warning
61
- ) => void
59
+ callback: (warning: import('postcss').Warning) => void
62
60
  ) => void;
63
61
  };
64
62
  };
@@ -37,7 +37,7 @@ export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
37
37
  export function getStylelintOptions(
38
38
  pluginOptions: Options
39
39
  ): Partial<StylelintOptions>;
40
- export type stylelint = import('stylelint/node_modules/postcss').PluginCreator<
40
+ export type stylelint = import('postcss').PluginCreator<
41
41
  import('stylelint').PostcssPluginOptions
42
42
  > & {
43
43
  lint: (
@@ -77,11 +77,9 @@ export type stylelint = import('stylelint/node_modules/postcss').PluginCreator<
77
77
  options: {
78
78
  ruleName: string;
79
79
  ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
80
- root: import('stylelint/node_modules/postcss').Root;
80
+ root: import('postcss').Root;
81
81
  },
82
- callback: (
83
- warning: import('stylelint/node_modules/postcss').Warning
84
- ) => void
82
+ callback: (warning: import('postcss').Warning) => void
85
83
  ) => void;
86
84
  };
87
85
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="stylelint" />
2
- export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
2
+ export type Stylelint = import('postcss').PluginCreator<
3
3
  import('stylelint').PostcssPluginOptions
4
4
  > & {
5
5
  lint: (
@@ -39,11 +39,9 @@ export type Stylelint = import('stylelint/node_modules/postcss').PluginCreator<
39
39
  options: {
40
40
  ruleName: string;
41
41
  ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
42
- root: import('stylelint/node_modules/postcss').Root;
42
+ root: import('postcss').Root;
43
43
  },
44
- callback: (
45
- warning: import('stylelint/node_modules/postcss').Warning
46
- ) => void
44
+ callback: (warning: import('postcss').Warning) => void
47
45
  ) => void;
48
46
  };
49
47
  };
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
 
8
8
  class StylelintError extends Error {
9
- /**
10
- * @param {string=} messages
9
+ /**
10
+ * @param {string=} messages
11
11
  */
12
12
  constructor(messages) {
13
13
  super(messages);
@@ -33,9 +33,9 @@ const cache = {};
33
33
 
34
34
  /** @typedef {{stylelint: Stylelint, lintFiles: LintTask, cleanup: AsyncTask, threads: number, }} Linter */
35
35
 
36
- /**
37
- * @param {Options} options
38
- * @returns {Linter}
36
+ /**
37
+ * @param {Options} options
38
+ * @returns {Linter}
39
39
  */
40
40
 
41
41
  function loadStylelint(options) {
@@ -47,11 +47,11 @@ function loadStylelint(options) {
47
47
  threads: 1
48
48
  };
49
49
  }
50
- /**
51
- * @param {string|undefined} key
52
- * @param {number} poolSize
53
- * @param {Options} options
54
- * @returns {Linter}
50
+ /**
51
+ * @param {string|undefined} key
52
+ * @param {number} poolSize
53
+ * @param {Options} options
54
+ * @returns {Linter}
55
55
  */
56
56
 
57
57
 
@@ -94,10 +94,10 @@ function loadStylelintThreaded(key, poolSize, options) {
94
94
  };
95
95
  return context;
96
96
  }
97
- /**
98
- * @param {string|undefined} key
99
- * @param {Options} options
100
- * @returns {Linter}
97
+ /**
98
+ * @param {string|undefined} key
99
+ * @param {Options} options
100
+ * @returns {Linter}
101
101
  */
102
102
 
103
103
 
@@ -117,10 +117,10 @@ function getStylelint(key, {
117
117
 
118
118
  return cache[cacheKey];
119
119
  }
120
- /**
121
- * @param {string|undefined} key
122
- * @param {Options} options
123
- * @returns {string}
120
+ /**
121
+ * @param {string|undefined} key
122
+ * @param {Options} options
123
+ * @returns {string}
124
124
  */
125
125
 
126
126
 
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ const STYLELINT_PLUGIN = 'StylelintWebpackPlugin';
35
35
  let counter = 0;
36
36
 
37
37
  class StylelintWebpackPlugin {
38
- /**
39
- * @param {Options} options
38
+ /**
39
+ * @param {Options} options
40
40
  */
41
41
  constructor(options = {}) {
42
42
  this.key = STYLELINT_PLUGIN;
@@ -47,9 +47,9 @@ class StylelintWebpackPlugin {
47
47
 
48
48
  this.prevTimestamps = new Map();
49
49
  }
50
- /**
51
- * @param {Compiler} compiler
52
- * @returns {void}
50
+ /**
51
+ * @param {Compiler} compiler
52
+ * @returns {void}
53
53
  */
54
54
 
55
55
 
@@ -73,8 +73,8 @@ class StylelintWebpackPlugin {
73
73
  return this.run(c);
74
74
  });
75
75
  }
76
- /**
77
- * @param {Compiler} compiler
76
+ /**
77
+ * @param {Compiler} compiler
78
78
  */
79
79
 
80
80
 
@@ -161,10 +161,10 @@ class StylelintWebpackPlugin {
161
161
  }
162
162
  });
163
163
  }
164
- /**
165
- *
166
- * @param {Compiler} compiler
167
- * @returns {string}
164
+ /**
165
+ *
166
+ * @param {Compiler} compiler
167
+ * @returns {string}
168
168
  */
169
169
 
170
170
 
@@ -179,11 +179,11 @@ class StylelintWebpackPlugin {
179
179
 
180
180
  return this.options.context;
181
181
  }
182
- /**
183
- * @param {Compiler} compiler
184
- * @param {string[]} wanted
185
- * @param {string[]} exclude
186
- * @returns {string[]}
182
+ /**
183
+ * @param {Compiler} compiler
184
+ * @param {string[]} wanted
185
+ * @param {string[]} exclude
186
+ * @returns {string[]}
187
187
  */
188
188
  // eslint-disable-next-line no-unused-vars
189
189
 
@@ -214,18 +214,18 @@ class StylelintWebpackPlugin {
214
214
  ignore: exclude
215
215
  });
216
216
  }
217
- /**
218
- * @param {ReadonlyMap<string, null | FileSystemInfoEntry | "ignore" | undefined>} fileTimestamps
219
- * @returns {string[]}
217
+ /**
218
+ * @param {ReadonlyMap<string, null | FileSystemInfoEntry | "ignore" | undefined>} fileTimestamps
219
+ * @returns {string[]}
220
220
  */
221
221
 
222
222
  /* istanbul ignore next */
223
223
 
224
224
 
225
225
  getChangedFiles(fileTimestamps) {
226
- /**
227
- * @param {null | FileSystemInfoEntry | "ignore" | undefined} fileSystemInfoEntry
228
- * @returns {Partial<number>}
226
+ /**
227
+ * @param {null | FileSystemInfoEntry | "ignore" | undefined} fileSystemInfoEntry
228
+ * @returns {Partial<number>}
229
229
  */
230
230
  const getTimestamps = fileSystemInfoEntry => {
231
231
  // @ts-ignore
@@ -237,10 +237,10 @@ class StylelintWebpackPlugin {
237
237
 
238
238
  return fileSystemInfoEntry;
239
239
  };
240
- /**
241
- * @param {string} filename
242
- * @param {null | FileSystemInfoEntry | "ignore" | undefined} fileSystemInfoEntry
243
- * @returns {boolean}
240
+ /**
241
+ * @param {string} filename
242
+ * @param {null | FileSystemInfoEntry | "ignore" | undefined} fileSystemInfoEntry
243
+ * @returns {boolean}
244
244
  */
245
245
 
246
246
 
package/dist/linter.js CHANGED
@@ -43,11 +43,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
43
43
 
44
44
  /** @type {WeakMap<Compiler, LintResultMap>} */
45
45
  const resultStorage = new WeakMap();
46
- /**
47
- * @param {string|undefined} key
48
- * @param {Options} options
49
- * @param {Compilation} compilation
50
- * @returns {{lint: Linter, report: Reporter, threads: number}}
46
+ /**
47
+ * @param {string|undefined} key
48
+ * @param {Options} options
49
+ * @param {Compilation} compilation
50
+ * @returns {{lint: Linter, report: Reporter, threads: number}}
51
51
  */
52
52
 
53
53
  function linter(key, options, compilation) {
@@ -83,8 +83,8 @@ function linter(key, options, compilation) {
83
83
  report,
84
84
  threads
85
85
  };
86
- /**
87
- * @param {string | string[]} files
86
+ /**
87
+ * @param {string | string[]} files
88
88
  */
89
89
 
90
90
  function lint(files) {
@@ -124,9 +124,9 @@ function linter(key, options, compilation) {
124
124
  warnings,
125
125
  generateReportAsset
126
126
  };
127
- /**
128
- * @param {Compilation} compilation
129
- * @returns {Promise<void>}
127
+ /**
128
+ * @param {Compilation} compilation
129
+ * @returns {Promise<void>}
130
130
  */
131
131
 
132
132
  async function generateReportAsset({
@@ -135,9 +135,9 @@ function linter(key, options, compilation) {
135
135
  const {
136
136
  outputReport
137
137
  } = options;
138
- /**
139
- * @param {string} name
140
- * @param {string | Buffer} content
138
+ /**
139
+ * @param {string} name
140
+ * @param {string | Buffer} content
141
141
  */
142
142
 
143
143
  const save = (name, content) =>
@@ -177,10 +177,10 @@ function linter(key, options, compilation) {
177
177
  }
178
178
  }
179
179
  }
180
- /**
181
- * @param {FormatterFunction} formatter
182
- * @param {{ errors: LintResult[]; warnings: LintResult[]; }} results
183
- * @returns {{errors?: StylelintError, warnings?: StylelintError}}
180
+ /**
181
+ * @param {FormatterFunction} formatter
182
+ * @param {{ errors: LintResult[]; warnings: LintResult[]; }} results
183
+ * @returns {{errors?: StylelintError, warnings?: StylelintError}}
184
184
  */
185
185
 
186
186
 
@@ -201,10 +201,10 @@ function formatResults(formatter, results) {
201
201
  warnings
202
202
  };
203
203
  }
204
- /**
205
- * @param {Options} options
206
- * @param {LintResult[]} results
207
- * @returns {{errors: LintResult[], warnings: LintResult[]}}
204
+ /**
205
+ * @param {Options} options
206
+ * @param {LintResult[]} results
207
+ * @returns {{errors: LintResult[], warnings: LintResult[]}}
208
208
  */
209
209
 
210
210
 
@@ -236,10 +236,10 @@ function parseResults(options, results) {
236
236
  warnings
237
237
  };
238
238
  }
239
- /**
240
- * @param {Stylelint} stylelint
241
- * @param {FormatterType=} formatter
242
- * @returns {FormatterFunction}
239
+ /**
240
+ * @param {Stylelint} stylelint
241
+ * @param {FormatterType=} formatter
242
+ * @returns {FormatterFunction}
243
243
  */
244
244
 
245
245
 
@@ -257,33 +257,33 @@ function loadFormatter(stylelint, formatter) {
257
257
 
258
258
  return stylelint.formatters.string;
259
259
  }
260
- /**
261
- * @param {LintResult[]} results
262
- * @returns {LintResult[]}
260
+ /**
261
+ * @param {LintResult[]} results
262
+ * @returns {LintResult[]}
263
263
  */
264
264
 
265
265
 
266
266
  function removeIgnoredWarnings(results) {
267
267
  return results.filter(result => !result.ignored);
268
268
  }
269
- /**
270
- * @param {Promise<LintResult[]>[]} results
271
- * @returns {Promise<LintResult[]>}
269
+ /**
270
+ * @param {Promise<LintResult[]>[]} results
271
+ * @returns {Promise<LintResult[]>}
272
272
  */
273
273
 
274
274
 
275
275
  async function flatten(results) {
276
- /**
277
- * @param {LintResult[]} acc
278
- * @param {LintResult[]} list
276
+ /**
277
+ * @param {LintResult[]} acc
278
+ * @param {LintResult[]} list
279
279
  */
280
280
  const flat = (acc, list) => [...acc, ...list];
281
281
 
282
282
  return (await Promise.all(results)).reduce(flat, []);
283
283
  }
284
- /**
285
- * @param {Compilation} compilation
286
- * @returns {LintResultMap}
284
+ /**
285
+ * @param {Compilation} compilation
286
+ * @returns {LintResultMap}
287
287
  */
288
288
 
289
289
 
package/dist/options.js CHANGED
@@ -20,35 +20,35 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
 
21
21
  /** @typedef {import("stylelint").FormatterType} FormatterType */
22
22
 
23
- /**
24
- * @typedef {Object} OutputReport
25
- * @property {string=} filePath
26
- * @property {FormatterType=} formatter
23
+ /**
24
+ * @typedef {Object} OutputReport
25
+ * @property {string=} filePath
26
+ * @property {FormatterType=} formatter
27
27
  */
28
28
 
29
- /**
30
- * @typedef {Object} PluginOptions
31
- * @property {string} context
32
- * @property {boolean} emitError
33
- * @property {boolean} emitWarning
34
- * @property {string|string[]=} exclude
35
- * @property {string|string[]} extensions
36
- * @property {boolean} failOnError
37
- * @property {boolean} failOnWarning
38
- * @property {string|string[]} files
39
- * @property {FormatterType} formatter
40
- * @property {boolean} lintDirtyModulesOnly
41
- * @property {boolean} quiet
42
- * @property {string} stylelintPath
43
- * @property {OutputReport} outputReport
44
- * @property {number|boolean=} threads
29
+ /**
30
+ * @typedef {Object} PluginOptions
31
+ * @property {string} context
32
+ * @property {boolean} emitError
33
+ * @property {boolean} emitWarning
34
+ * @property {string|string[]=} exclude
35
+ * @property {string|string[]} extensions
36
+ * @property {boolean} failOnError
37
+ * @property {boolean} failOnWarning
38
+ * @property {string|string[]} files
39
+ * @property {FormatterType} formatter
40
+ * @property {boolean} lintDirtyModulesOnly
41
+ * @property {boolean} quiet
42
+ * @property {string} stylelintPath
43
+ * @property {OutputReport} outputReport
44
+ * @property {number|boolean=} threads
45
45
  */
46
46
 
47
47
  /** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
48
48
 
49
- /**
50
- * @param {Options} pluginOptions
51
- * @returns {Partial<PluginOptions>}
49
+ /**
50
+ * @param {Options} pluginOptions
51
+ * @returns {Partial<PluginOptions>}
52
52
  */
53
53
  function getOptions(pluginOptions) {
54
54
  const options = {
@@ -69,9 +69,9 @@ function getOptions(pluginOptions) {
69
69
  });
70
70
  return options;
71
71
  }
72
- /**
73
- * @param {Options} pluginOptions
74
- * @returns {Partial<StylelintOptions>}
72
+ /**
73
+ * @param {Options} pluginOptions
74
+ * @returns {Partial<StylelintOptions>}
75
75
  */
76
76
 
77
77
 
package/dist/options.json CHANGED
@@ -1,80 +1,80 @@
1
- {
2
- "type": "object",
3
- "additionalProperties": true,
4
- "properties": {
5
- "context": {
6
- "description": "A string indicating the root of your files.",
7
- "type": "string"
8
- },
9
- "emitError": {
10
- "description": "The errors found will always be emitted, to disable set to `false`.",
11
- "type": "boolean"
12
- },
13
- "emitWarning": {
14
- "description": "The warnings found will always be emitted, to disable set to `false`.",
15
- "type": "boolean"
16
- },
17
- "exclude": {
18
- "description": "Specify the files and/or directories to exclude. Must be relative to `options.context`.",
19
- "anyOf": [{ "type": "string" }, { "type": "array" }]
20
- },
21
- "extensions": {
22
- "description": "Specify extensions that should be checked.",
23
- "anyOf": [{ "type": "string" }, { "type": "array" }]
24
- },
25
- "failOnError": {
26
- "description": "Will cause the module build to fail if there are any errors, to disable set to `false`.",
27
- "type": "boolean"
28
- },
29
- "failOnWarning": {
30
- "description": "Will cause the module build to fail if there are any warnings, if set to `true`.",
31
- "type": "boolean"
32
- },
33
- "files": {
34
- "description": "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`.",
35
- "anyOf": [{ "type": "string" }, { "type": "array" }]
36
- },
37
- "formatter": {
38
- "description": "Specify the formatter that you would like to use to format your results.",
39
- "anyOf": [{ "type": "string" }, { "instanceof": "Function" }]
40
- },
41
- "lintDirtyModulesOnly": {
42
- "description": "Lint only changed files, skip lint on start.",
43
- "type": "boolean"
44
- },
45
- "quiet": {
46
- "description": "Will process and report errors only and ignore warnings, if set to `true`.",
47
- "type": "boolean"
48
- },
49
- "stylelintPath": {
50
- "description": "Path to `stylelint` instance that will be used for linting.",
51
- "type": "string"
52
- },
53
- "outputReport": {
54
- "description": "Write the output of the errors to a file, for example a `json` file for use for reporting.",
55
- "anyOf": [
56
- {
57
- "type": "boolean"
58
- },
59
- {
60
- "type": "object",
61
- "additionalProperties": false,
62
- "properties": {
63
- "filePath": {
64
- "description": "The `filePath` is relative to the webpack config: `output.path`.",
65
- "anyOf": [{ "type": "string" }]
66
- },
67
- "formatter": {
68
- "description": "You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used.",
69
- "anyOf": [{ "type": "string" }, { "instanceof": "Function" }]
70
- }
71
- }
72
- }
73
- ]
74
- },
75
- "threads": {
76
- "description": "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.",
77
- "anyOf": [{ "type": "number" }, { "type": "boolean" }]
78
- }
79
- }
80
- }
1
+ {
2
+ "type": "object",
3
+ "additionalProperties": true,
4
+ "properties": {
5
+ "context": {
6
+ "description": "A string indicating the root of your files.",
7
+ "type": "string"
8
+ },
9
+ "emitError": {
10
+ "description": "The errors found will always be emitted, to disable set to `false`.",
11
+ "type": "boolean"
12
+ },
13
+ "emitWarning": {
14
+ "description": "The warnings found will always be emitted, to disable set to `false`.",
15
+ "type": "boolean"
16
+ },
17
+ "exclude": {
18
+ "description": "Specify the files and/or directories to exclude. Must be relative to `options.context`.",
19
+ "anyOf": [{ "type": "string" }, { "type": "array" }]
20
+ },
21
+ "extensions": {
22
+ "description": "Specify extensions that should be checked.",
23
+ "anyOf": [{ "type": "string" }, { "type": "array" }]
24
+ },
25
+ "failOnError": {
26
+ "description": "Will cause the module build to fail if there are any errors, to disable set to `false`.",
27
+ "type": "boolean"
28
+ },
29
+ "failOnWarning": {
30
+ "description": "Will cause the module build to fail if there are any warnings, if set to `true`.",
31
+ "type": "boolean"
32
+ },
33
+ "files": {
34
+ "description": "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`.",
35
+ "anyOf": [{ "type": "string" }, { "type": "array" }]
36
+ },
37
+ "formatter": {
38
+ "description": "Specify the formatter that you would like to use to format your results.",
39
+ "anyOf": [{ "type": "string" }, { "instanceof": "Function" }]
40
+ },
41
+ "lintDirtyModulesOnly": {
42
+ "description": "Lint only changed files, skip lint on start.",
43
+ "type": "boolean"
44
+ },
45
+ "quiet": {
46
+ "description": "Will process and report errors only and ignore warnings, if set to `true`.",
47
+ "type": "boolean"
48
+ },
49
+ "stylelintPath": {
50
+ "description": "Path to `stylelint` instance that will be used for linting.",
51
+ "type": "string"
52
+ },
53
+ "outputReport": {
54
+ "description": "Write the output of the errors to a file, for example a `json` file for use for reporting.",
55
+ "anyOf": [
56
+ {
57
+ "type": "boolean"
58
+ },
59
+ {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "properties": {
63
+ "filePath": {
64
+ "description": "The `filePath` is relative to the webpack config: `output.path`.",
65
+ "anyOf": [{ "type": "string" }]
66
+ },
67
+ "formatter": {
68
+ "description": "You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used.",
69
+ "anyOf": [{ "type": "string" }, { "instanceof": "Function" }]
70
+ }
71
+ }
72
+ }
73
+ ]
74
+ },
75
+ "threads": {
76
+ "description": "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.",
77
+ "anyOf": [{ "type": "number" }, { "type": "boolean" }]
78
+ }
79
+ }
80
+ }
package/dist/utils.js CHANGED
@@ -20,10 +20,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  // @ts-ignore
21
21
  // @ts-ignore
22
22
 
23
- /**
24
- * @param {string|(string|undefined)[]} files
25
- * @param {string} context
26
- * @returns {string[]}
23
+ /**
24
+ * @param {string|(string|undefined)[]} files
25
+ * @param {string} context
26
+ * @returns {string[]}
27
27
  */
28
28
  function parseFiles(files, context) {
29
29
  return (0, _arrify.default)(files).filter((
@@ -32,10 +32,10 @@ function parseFiles(files, context) {
32
32
  /** @type {string} */
33
33
  file) => (0, _normalizePath.default)((0, _path.resolve)(context, file)));
34
34
  }
35
- /**
36
- * @param {string|string[]} patterns
37
- * @param {string|string[]} extensions
38
- * @returns {string[]}
35
+ /**
36
+ * @param {string|string[]} patterns
37
+ * @param {string|string[]} extensions
38
+ * @returns {string[]}
39
39
  */
40
40
 
41
41
 
@@ -62,17 +62,17 @@ function parseFoldersToGlobs(patterns, extensions = []) {
62
62
  return pattern;
63
63
  });
64
64
  }
65
- /**
66
- *
67
- * @param {string} _ key, but unused
68
- * @param {any} value
65
+ /**
66
+ *
67
+ * @param {string} _ key, but unused
68
+ * @param {any} value
69
69
  */
70
70
 
71
71
 
72
72
  const jsonStringifyReplacerSortKeys = (_, value) => {
73
- /**
74
- * @param {{ [x: string]: any; }} sorted
75
- * @param {string | number} key
73
+ /**
74
+ * @param {{ [x: string]: any; }} sorted
75
+ * @param {string | number} key
76
76
  */
77
77
  const insert = (sorted, key) => {
78
78
  // eslint-disable-next-line no-param-reassign
package/dist/worker.js CHANGED
@@ -15,9 +15,9 @@ let stylelint;
15
15
  /** @type {Partial<StylelintOptions>} */
16
16
 
17
17
  let linterOptions;
18
- /**
19
- * @param {Options} options
20
- * @param {Partial<StylelintOptions>} stylelintOptions
18
+ /**
19
+ * @param {Options} options
20
+ * @param {Partial<StylelintOptions>} stylelintOptions
21
21
  */
22
22
 
23
23
  function setup(options, stylelintOptions) {
@@ -25,8 +25,8 @@ function setup(options, stylelintOptions) {
25
25
  linterOptions = stylelintOptions;
26
26
  return stylelint;
27
27
  }
28
- /**
29
- * @param {string | string[]} files
28
+ /**
29
+ * @param {string | string[]} files
30
30
  */
31
31
 
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-webpack-plugin",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "A Stylelint plugin for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/stylelint-webpack-plugin",
@@ -46,10 +46,9 @@
46
46
  "webpack": "^4.0.0 || ^5.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@types/stylelint": "^13.13.3",
50
49
  "arrify": "^2.0.1",
51
- "jest-worker": "^27.3.1",
52
50
  "globby": "^11.0.4",
51
+ "jest-worker": "^27.3.1",
53
52
  "micromatch": "^4.0.4",
54
53
  "normalize-path": "^3.0.0",
55
54
  "schema-utils": "^3.1.1"