stylelint-webpack-plugin 2.3.2 → 2.5.0

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,199 +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@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
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
@@ -1,21 +1,13 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
3
  class StylelintError extends Error {
9
- /**
10
- * @param {string=} messages
4
+ /**
5
+ * @param {string=} messages
11
6
  */
12
7
  constructor(messages) {
13
- super(messages);
8
+ super(`[stylelint] ${messages}`);
14
9
  this.name = 'StylelintError';
15
10
  this.stack = '';
16
11
  }
17
-
18
12
  }
19
-
20
- var _default = StylelintError;
21
- exports.default = _default;
13
+ module.exports = StylelintError;
@@ -1,91 +1,96 @@
1
1
  "use strict";
2
2
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = getStylelint;
7
-
8
- var _os = require("os");
9
-
10
- var _jestWorker = require("jest-worker");
11
-
12
- var _worker = require("./worker");
13
-
14
- var _utils = require("./utils");
15
-
16
- var _options = require("./options");
3
+ const {
4
+ cpus
5
+ } = require('os');
6
+ const {
7
+ Worker: JestWorker
8
+ } = require('jest-worker');
17
9
 
18
10
  // @ts-ignore
11
+ const {
12
+ setup,
13
+ lintFiles
14
+ } = require('./worker');
15
+ const {
16
+ jsonStringifyReplacerSortKeys
17
+ } = require('./utils');
18
+ const {
19
+ getStylelintOptions
20
+ } = require('./options');
19
21
 
20
22
  /** @type {{[key: string]: any}} */
21
23
  const cache = {};
22
- /** @typedef {import('stylelint')} Stylelint */
23
24
 
25
+ /** @typedef {{lint: (options: LinterOptions) => Promise<LinterResult>, formatters: { [k: string]: Formatter }}} Stylelint */
24
26
  /** @typedef {import('stylelint').LintResult} LintResult */
25
-
27
+ /** @typedef {import('stylelint').LinterOptions} LinterOptions */
28
+ /** @typedef {import('stylelint').LinterResult} LinterResult */
29
+ /** @typedef {import('stylelint').Formatter} Formatter */
30
+ /** @typedef {import('stylelint').FormatterType} FormatterType */
26
31
  /** @typedef {import('./options').Options} Options */
27
-
32
+ /** @typedef {(stylelint: Stylelint, filePath: string) => Promise<boolean>} isPathIgnored */
28
33
  /** @typedef {() => Promise<void>} AsyncTask */
29
-
30
34
  /** @typedef {(files: string|string[]) => Promise<LintResult[]>} LintTask */
31
-
35
+ /** @typedef {{stylelint: Stylelint, isPathIgnored: isPathIgnored, lintFiles: LintTask, cleanup: AsyncTask, threads: number }} Linter */
32
36
  /** @typedef {JestWorker & {lintFiles: LintTask}} Worker */
33
37
 
34
- /** @typedef {{stylelint: Stylelint, lintFiles: LintTask, cleanup: AsyncTask, threads: number, }} Linter */
35
-
36
- /**
37
- * @param {Options} options
38
- * @returns {Linter}
38
+ /**
39
+ * @param {Options} options
40
+ * @returns {Linter}
39
41
  */
40
-
41
42
  function loadStylelint(options) {
42
- const stylelint = (0, _worker.setup)(options, (0, _options.getStylelintOptions)(options));
43
+ const stylelintOptions = getStylelintOptions(options);
44
+ const stylelint = setup(options, stylelintOptions);
45
+
46
+ /** @type {isPathIgnored} */
47
+ let isPathIgnored;
48
+ try {
49
+ isPathIgnored = require(`${options.stylelintPath}/lib/isPathIgnored`);
50
+ } catch (e) {
51
+ try {
52
+ // @ts-ignore
53
+ isPathIgnored = require('stylelint/lib/isPathIgnored');
54
+ } catch (_) {
55
+ isPathIgnored = () => Promise.resolve(false);
56
+ }
57
+ }
43
58
  return {
44
59
  stylelint,
45
- lintFiles: _worker.lintFiles,
60
+ isPathIgnored,
61
+ lintFiles,
46
62
  cleanup: async () => {},
47
63
  threads: 1
48
64
  };
49
65
  }
50
- /**
51
- * @param {string|undefined} key
52
- * @param {number} poolSize
53
- * @param {Options} options
54
- * @returns {Linter}
55
- */
56
-
57
66
 
67
+ /**
68
+ * @param {string|undefined} key
69
+ * @param {number} poolSize
70
+ * @param {Options} options
71
+ * @returns {Linter}
72
+ */
58
73
  function loadStylelintThreaded(key, poolSize, options) {
59
74
  const cacheKey = getCacheKey(key, options);
60
-
61
75
  const source = require.resolve('./worker');
62
-
63
76
  const workerOptions = {
64
77
  enableWorkerThreads: true,
65
78
  numWorkers: poolSize,
66
- setupArgs: [options, (0, _options.getStylelintOptions)(options)]
79
+ setupArgs: [options, getStylelintOptions(options)]
67
80
  };
68
81
  const local = loadStylelint(options);
69
- /** @type {Worker?} */
70
- // prettier-ignore
82
+ let worker = /** @type {Worker?} */new JestWorker(source, workerOptions);
71
83
 
72
- let worker =
73
- /** @type {Worker} */
74
- new _jestWorker.Worker(source, workerOptions);
75
84
  /** @type {Linter} */
76
-
77
- const context = { ...local,
85
+ const context = {
86
+ ...local,
78
87
  threads: poolSize,
79
- lintFiles: async files =>
80
- /* istanbul ignore next */
88
+ lintFiles: async files => /* istanbul ignore next */
81
89
  worker ? worker.lintFiles(files) : local.lintFiles(files),
82
90
  cleanup: async () => {
83
91
  cache[cacheKey] = local;
84
-
85
92
  context.lintFiles = files => local.lintFiles(files);
86
93
  /* istanbul ignore next */
87
-
88
-
89
94
  if (worker) {
90
95
  worker.end();
91
96
  worker = null;
@@ -94,39 +99,36 @@ function loadStylelintThreaded(key, poolSize, options) {
94
99
  };
95
100
  return context;
96
101
  }
97
- /**
98
- * @param {string|undefined} key
99
- * @param {Options} options
100
- * @returns {Linter}
101
- */
102
-
103
102
 
103
+ /**
104
+ * @param {string|undefined} key
105
+ * @param {Options} options
106
+ * @returns {Linter}
107
+ */
104
108
  function getStylelint(key, {
105
109
  threads,
106
110
  ...options
107
111
  }) {
108
- const max = typeof threads !== 'number' ? threads ? (0, _os.cpus)().length - 1 : 1 : threads;
112
+ const max = typeof threads !== 'number' ? threads ? cpus().length - 1 : 1 : threads;
109
113
  const cacheKey = getCacheKey(key, {
110
114
  threads,
111
115
  ...options
112
116
  });
113
-
114
117
  if (!cache[cacheKey]) {
115
118
  cache[cacheKey] = max > 1 ? loadStylelintThreaded(key, max, options) : loadStylelint(options);
116
119
  }
117
-
118
120
  return cache[cacheKey];
119
121
  }
120
- /**
121
- * @param {string|undefined} key
122
- * @param {Options} options
123
- * @returns {string}
124
- */
125
-
126
122
 
123
+ /**
124
+ * @param {string|undefined} key
125
+ * @param {Options} options
126
+ * @returns {string}
127
+ */
127
128
  function getCacheKey(key, options) {
128
129
  return JSON.stringify({
129
130
  key,
130
131
  options
131
- }, _utils.jsonStringifyReplacerSortKeys);
132
- }
132
+ }, jsonStringifyReplacerSortKeys);
133
+ }
134
+ module.exports = getStylelint;