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 +20 -20
- package/README.md +199 -199
- package/dist/StylelintError.js +4 -12
- package/dist/getStylelint.js +68 -66
- package/dist/index.js +111 -123
- package/dist/linter.js +130 -134
- package/dist/options.js +48 -52
- package/dist/options.json +80 -80
- package/dist/utils.js +38 -58
- package/dist/worker.js +16 -16
- package/package.json +27 -27
- package/types/StylelintError.d.ts +8 -0
- package/types/getStylelint.d.ts +56 -0
- package/{declarations → types}/index.d.ts +22 -11
- package/types/linter.d.ts +59 -0
- package/types/options.d.ts +60 -0
- package/{declarations → types}/utils.d.ts +5 -0
- package/types/worker.d.ts +3 -0
- package/declarations/StylelintError.d.ts +0 -2
- package/declarations/cjs.d.ts +0 -3
- package/declarations/getStylelint.d.ts +0 -70
- package/declarations/linter.d.ts +0 -80
- package/declarations/options.d.ts +0 -108
- package/declarations/worker.d.ts +0 -49
- package/dist/cjs.js +0 -5
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
|
@@ -1,86 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _arrify = _interopRequireDefault(require("arrify"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {string|(string|undefined)[]} files
|
|
25
|
-
* @param {string} context
|
|
26
|
-
* @returns {string[]}
|
|
3
|
+
const {
|
|
4
|
+
resolve
|
|
5
|
+
} = require('path');
|
|
6
|
+
const {
|
|
7
|
+
statSync
|
|
8
|
+
} = require('fs');
|
|
9
|
+
const normalizePath = require('normalize-path');
|
|
10
|
+
const arrify = require('arrify');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string|(string|undefined)[]} files
|
|
14
|
+
* @param {string} context
|
|
15
|
+
* @returns {string[]}
|
|
27
16
|
*/
|
|
28
17
|
function parseFiles(files, context) {
|
|
29
|
-
return (
|
|
30
|
-
/** @type {string} */
|
|
31
|
-
file) => typeof file === 'string').map((
|
|
32
|
-
/** @type {string} */
|
|
33
|
-
file) => (0, _normalizePath.default)((0, _path.resolve)(context, file)));
|
|
18
|
+
return arrify(files).filter(file => typeof file === 'string').map(file => normalizePath(resolve(context, file || '')));
|
|
34
19
|
}
|
|
35
|
-
/**
|
|
36
|
-
* @param {string|string[]} patterns
|
|
37
|
-
* @param {string|string[]} extensions
|
|
38
|
-
* @returns {string[]}
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @param {string|string[]} patterns
|
|
23
|
+
* @param {string|string[]} extensions
|
|
24
|
+
* @returns {string[]}
|
|
25
|
+
*/
|
|
42
26
|
function parseFoldersToGlobs(patterns, extensions = []) {
|
|
43
|
-
const extensionsList = (
|
|
27
|
+
const extensionsList = arrify(extensions);
|
|
44
28
|
const [prefix, postfix] = extensionsList.length > 1 ? ['{', '}'] : ['', ''];
|
|
45
|
-
const extensionsGlob = extensionsList.map((
|
|
46
|
-
/** @type {string} */
|
|
47
|
-
extension) => extension.replace(/^\./u, '')).join(',');
|
|
48
|
-
return (0, _arrify.default)(patterns).map((
|
|
49
|
-
/** @type {string} */
|
|
50
|
-
pattern) => {
|
|
29
|
+
const extensionsGlob = extensionsList.map(( /** @type {string} */extension) => extension.replace(/^\./u, '')).join(',');
|
|
30
|
+
return arrify(patterns).map(( /** @type {string} */pattern) => {
|
|
51
31
|
try {
|
|
52
32
|
// The patterns are absolute because they are prepended with the context.
|
|
53
|
-
const stats =
|
|
33
|
+
const stats = statSync(pattern);
|
|
54
34
|
/* istanbul ignore else */
|
|
55
|
-
|
|
56
35
|
if (stats.isDirectory()) {
|
|
57
36
|
return pattern.replace(/[/\\]*?$/u, `/**${extensionsGlob ? `/*.${prefix + extensionsGlob + postfix}` : ''}`);
|
|
58
37
|
}
|
|
59
|
-
} catch (_) {
|
|
38
|
+
} catch (_) {
|
|
39
|
+
// Return the pattern as is on error.
|
|
60
40
|
}
|
|
61
|
-
|
|
62
41
|
return pattern;
|
|
63
42
|
});
|
|
64
43
|
}
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param {string} _ key, but unused
|
|
68
|
-
* @param {any} value
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
44
|
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @param {string} _ key, but unused
|
|
48
|
+
* @param {any} value
|
|
49
|
+
*/
|
|
72
50
|
const jsonStringifyReplacerSortKeys = (_, value) => {
|
|
73
|
-
/**
|
|
74
|
-
* @param {{ [x: string]: any; }} sorted
|
|
75
|
-
* @param {string | number} key
|
|
51
|
+
/**
|
|
52
|
+
* @param {{ [x: string]: any; }} sorted
|
|
53
|
+
* @param {string | number} key
|
|
76
54
|
*/
|
|
77
55
|
const insert = (sorted, key) => {
|
|
78
56
|
// eslint-disable-next-line no-param-reassign
|
|
79
57
|
sorted[key] = value[key];
|
|
80
58
|
return sorted;
|
|
81
59
|
};
|
|
82
|
-
|
|
83
60
|
return value instanceof Object && !(value instanceof Array) ? Object.keys(value).sort().reduce(insert, {}) : value;
|
|
84
61
|
};
|
|
85
|
-
|
|
86
|
-
|
|
62
|
+
module.exports = {
|
|
63
|
+
parseFiles,
|
|
64
|
+
parseFoldersToGlobs,
|
|
65
|
+
jsonStringifyReplacerSortKeys
|
|
66
|
+
};
|
package/dist/worker.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/** @typedef {import('
|
|
4
|
-
|
|
5
|
-
/** @typedef {import("stylelint").LinterOptions} StylelintOptions */
|
|
6
|
-
|
|
3
|
+
/** @typedef {import('./getStylelint').Stylelint} Stylelint */
|
|
4
|
+
/** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
|
|
7
5
|
/** @typedef {import('./options').Options} Options */
|
|
6
|
+
|
|
8
7
|
Object.assign(module.exports, {
|
|
9
8
|
lintFiles,
|
|
10
9
|
setup
|
|
11
10
|
});
|
|
12
|
-
/** @type {Stylelint} */
|
|
13
11
|
|
|
12
|
+
/** @type {Stylelint} */
|
|
14
13
|
let stylelint;
|
|
15
|
-
/** @type {Partial<StylelintOptions>} */
|
|
16
14
|
|
|
15
|
+
/** @type {Partial<StylelintOptions>} */
|
|
17
16
|
let linterOptions;
|
|
18
|
-
/**
|
|
19
|
-
* @param {Options} options
|
|
20
|
-
* @param {Partial<StylelintOptions>} stylelintOptions
|
|
21
|
-
*/
|
|
22
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @param {Options} options
|
|
20
|
+
* @param {Partial<StylelintOptions>} stylelintOptions
|
|
21
|
+
*/
|
|
23
22
|
function setup(options, stylelintOptions) {
|
|
24
23
|
stylelint = require(options.stylelintPath || 'stylelint');
|
|
25
24
|
linterOptions = stylelintOptions;
|
|
26
25
|
return stylelint;
|
|
27
26
|
}
|
|
28
|
-
/**
|
|
29
|
-
* @param {string | string[]} files
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
27
|
|
|
28
|
+
/**
|
|
29
|
+
* @param {string | string[]} files
|
|
30
|
+
*/
|
|
33
31
|
async function lintFiles(files) {
|
|
34
32
|
const {
|
|
35
33
|
results
|
|
36
|
-
} = await stylelint.lint({
|
|
34
|
+
} = await stylelint.lint({
|
|
35
|
+
...linterOptions,
|
|
37
36
|
files
|
|
38
|
-
});
|
|
37
|
+
});
|
|
39
38
|
|
|
39
|
+
// Reset result to work with worker
|
|
40
40
|
return results.map(result => {
|
|
41
41
|
return {
|
|
42
42
|
source: result.source,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylelint-webpack-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "A Stylelint plugin for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/stylelint-webpack-plugin",
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
"type": "opencollective",
|
|
12
12
|
"url": "https://opencollective.com/webpack"
|
|
13
13
|
},
|
|
14
|
-
"main": "dist/
|
|
15
|
-
"types": "
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "types/index.d.ts",
|
|
16
16
|
"engines": {
|
|
17
17
|
"node": ">= 10.13.0"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"start": "npm run build -- -w",
|
|
21
|
-
"clean": "del-cli dist
|
|
21
|
+
"clean": "del-cli dist types",
|
|
22
22
|
"prebuild": "npm run clean",
|
|
23
|
-
"build:types": "tsc --declaration --emitDeclarationOnly --outDir
|
|
23
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write",
|
|
24
24
|
"build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
|
|
25
25
|
"build": "npm-run-all -p \"build:**\"",
|
|
26
26
|
"commitlint": "commitlint --from=master",
|
|
@@ -39,52 +39,52 @@
|
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
42
|
-
"
|
|
42
|
+
"types"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"stylelint": "^13.0.0 || ^14.0.0",
|
|
45
|
+
"stylelint": "^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
46
46
|
"webpack": "^4.0.0 || ^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"arrify": "^2.0.1",
|
|
50
|
-
"globby": "^11.0
|
|
51
|
-
"jest-worker": "^
|
|
52
|
-
"micromatch": "^4.0.
|
|
50
|
+
"globby": "^11.1.0",
|
|
51
|
+
"jest-worker": "^28.1.3",
|
|
52
|
+
"micromatch": "^4.0.5",
|
|
53
53
|
"normalize-path": "^3.0.0",
|
|
54
54
|
"schema-utils": "^3.1.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/cli": "^7.
|
|
58
|
-
"@babel/core": "^7.
|
|
59
|
-
"@babel/preset-env": "^7.
|
|
60
|
-
"@commitlint/cli": "^
|
|
61
|
-
"@commitlint/config-conventional": "^
|
|
57
|
+
"@babel/cli": "^7.21.0",
|
|
58
|
+
"@babel/core": "^7.21.0",
|
|
59
|
+
"@babel/preset-env": "^7.20.2",
|
|
60
|
+
"@commitlint/cli": "^16.2.4",
|
|
61
|
+
"@commitlint/config-conventional": "^16.2.4",
|
|
62
62
|
"@types/fs-extra": "^9.0.13",
|
|
63
63
|
"@types/micromatch": "^4.0.2",
|
|
64
|
+
"@types/node": "^18.14.6",
|
|
64
65
|
"@types/normalize-path": "^3.0.0",
|
|
65
66
|
"@types/webpack": "^5.28.0",
|
|
66
67
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
67
68
|
"babel-eslint": "^10.1.0",
|
|
68
|
-
"babel-jest": "^
|
|
69
|
-
"chokidar": "^3.5.2",
|
|
69
|
+
"babel-jest": "^28.1.3",
|
|
70
70
|
"cross-env": "^7.0.3",
|
|
71
|
-
"del": "^6.
|
|
71
|
+
"del": "^6.1.1",
|
|
72
72
|
"del-cli": "^3.0.1",
|
|
73
73
|
"eslint": "^7.32.0",
|
|
74
|
-
"eslint-config-prettier": "^8.
|
|
75
|
-
"eslint-plugin-import": "^2.
|
|
74
|
+
"eslint-config-prettier": "^8.7.0",
|
|
75
|
+
"eslint-plugin-import": "^2.27.5",
|
|
76
76
|
"file-loader": "^6.2.0",
|
|
77
77
|
"fs-extra": "^9.1.0",
|
|
78
78
|
"husky": "^6.0.0",
|
|
79
|
-
"jest": "^
|
|
80
|
-
"lint-staged": "^
|
|
79
|
+
"jest": "^28.1.3",
|
|
80
|
+
"lint-staged": "^11.2.6",
|
|
81
81
|
"npm-run-all": "^4.1.5",
|
|
82
82
|
"postcss-scss": "^3.0.5",
|
|
83
|
-
"prettier": "^2.4
|
|
84
|
-
"standard-version": "^9.
|
|
85
|
-
"stylelint": "^
|
|
86
|
-
"typescript": "^4.
|
|
87
|
-
"webpack": "^5.
|
|
83
|
+
"prettier": "^2.8.4",
|
|
84
|
+
"standard-version": "^9.5.0",
|
|
85
|
+
"stylelint": "^15.2.0",
|
|
86
|
+
"typescript": "^4.9.5",
|
|
87
|
+
"webpack": "^5.76.0"
|
|
88
88
|
},
|
|
89
89
|
"keywords": [
|
|
90
90
|
"stylelint",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/// <reference types="stylelint" />
|
|
2
|
+
export = getStylelint;
|
|
3
|
+
/**
|
|
4
|
+
* @param {string|undefined} key
|
|
5
|
+
* @param {Options} options
|
|
6
|
+
* @returns {Linter}
|
|
7
|
+
*/
|
|
8
|
+
declare function getStylelint(
|
|
9
|
+
key: string | undefined,
|
|
10
|
+
{ threads, ...options }: Options
|
|
11
|
+
): Linter;
|
|
12
|
+
declare namespace getStylelint {
|
|
13
|
+
export {
|
|
14
|
+
Stylelint,
|
|
15
|
+
LintResult,
|
|
16
|
+
LinterOptions,
|
|
17
|
+
LinterResult,
|
|
18
|
+
Formatter,
|
|
19
|
+
FormatterType,
|
|
20
|
+
Options,
|
|
21
|
+
isPathIgnored,
|
|
22
|
+
AsyncTask,
|
|
23
|
+
LintTask,
|
|
24
|
+
Linter,
|
|
25
|
+
Worker,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
type Options = import('./options').Options;
|
|
29
|
+
type Linter = {
|
|
30
|
+
stylelint: Stylelint;
|
|
31
|
+
isPathIgnored: isPathIgnored;
|
|
32
|
+
lintFiles: LintTask;
|
|
33
|
+
cleanup: AsyncTask;
|
|
34
|
+
threads: number;
|
|
35
|
+
};
|
|
36
|
+
type Stylelint = {
|
|
37
|
+
lint: (options: LinterOptions) => Promise<LinterResult>;
|
|
38
|
+
formatters: {
|
|
39
|
+
[k: string]: import('stylelint').Formatter;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
type LintResult = import('stylelint').LintResult;
|
|
43
|
+
type LinterOptions = import('stylelint').LinterOptions;
|
|
44
|
+
type LinterResult = import('stylelint').LinterResult;
|
|
45
|
+
type Formatter = import('stylelint').Formatter;
|
|
46
|
+
type FormatterType = import('stylelint').FormatterType;
|
|
47
|
+
type isPathIgnored = (
|
|
48
|
+
stylelint: Stylelint,
|
|
49
|
+
filePath: string
|
|
50
|
+
) => Promise<boolean>;
|
|
51
|
+
type AsyncTask = () => Promise<void>;
|
|
52
|
+
type LintTask = (files: string | string[]) => Promise<LintResult[]>;
|
|
53
|
+
type Worker = JestWorker & {
|
|
54
|
+
lintFiles: LintTask;
|
|
55
|
+
};
|
|
56
|
+
import { Worker as JestWorker } from 'jest-worker';
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export type Compiler = import('webpack').Compiler;
|
|
3
|
-
export type Module = import('webpack').Module;
|
|
4
|
-
export type Options = import('./options').Options;
|
|
5
|
-
export type FileSystemInfoEntry = Partial<
|
|
6
|
-
| {
|
|
7
|
-
timestamp: number;
|
|
8
|
-
}
|
|
9
|
-
| number
|
|
10
|
-
>;
|
|
1
|
+
export = StylelintWebpackPlugin;
|
|
11
2
|
declare class StylelintWebpackPlugin {
|
|
12
3
|
/**
|
|
13
4
|
* @param {Options} options
|
|
@@ -17,8 +8,16 @@ declare class StylelintWebpackPlugin {
|
|
|
17
8
|
options: Partial<import('./options').PluginOptions>;
|
|
18
9
|
/**
|
|
19
10
|
* @param {Compiler} compiler
|
|
11
|
+
* @param {Options} options
|
|
12
|
+
* @param {string[]} wanted
|
|
13
|
+
* @param {string[]} exclude
|
|
20
14
|
*/
|
|
21
|
-
run(
|
|
15
|
+
run(
|
|
16
|
+
compiler: Compiler,
|
|
17
|
+
options: Options,
|
|
18
|
+
wanted: string[],
|
|
19
|
+
exclude: string[]
|
|
20
|
+
): Promise<void>;
|
|
22
21
|
startTime: number;
|
|
23
22
|
/** @type {ReadonlyMap<string, null | FileSystemInfoEntry | "ignore" | undefined>} */
|
|
24
23
|
prevTimestamps: ReadonlyMap<
|
|
@@ -54,3 +53,15 @@ declare class StylelintWebpackPlugin {
|
|
|
54
53
|
>
|
|
55
54
|
): string[];
|
|
56
55
|
}
|
|
56
|
+
declare namespace StylelintWebpackPlugin {
|
|
57
|
+
export { Compiler, Module, Options, FileSystemInfoEntry };
|
|
58
|
+
}
|
|
59
|
+
type Compiler = import('webpack').Compiler;
|
|
60
|
+
type Options = import('./options').Options;
|
|
61
|
+
type FileSystemInfoEntry = Partial<
|
|
62
|
+
| {
|
|
63
|
+
timestamp: number;
|
|
64
|
+
}
|
|
65
|
+
| number
|
|
66
|
+
>;
|
|
67
|
+
type Module = import('webpack').Module;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="stylelint" />
|
|
2
|
+
export = linter;
|
|
3
|
+
/**
|
|
4
|
+
* @param {string|undefined} key
|
|
5
|
+
* @param {Options} options
|
|
6
|
+
* @param {Compilation} compilation
|
|
7
|
+
* @returns {{stylelint: Stylelint, isPathIgnored: isPathIgnored, lint: Linter, report: Reporter, threads: number}}
|
|
8
|
+
*/
|
|
9
|
+
declare function linter(
|
|
10
|
+
key: string | undefined,
|
|
11
|
+
options: Options,
|
|
12
|
+
compilation: Compilation
|
|
13
|
+
): {
|
|
14
|
+
stylelint: Stylelint;
|
|
15
|
+
isPathIgnored: getStylelint.isPathIgnored;
|
|
16
|
+
lint: Linter;
|
|
17
|
+
report: Reporter;
|
|
18
|
+
threads: number;
|
|
19
|
+
};
|
|
20
|
+
declare namespace linter {
|
|
21
|
+
export {
|
|
22
|
+
Compiler,
|
|
23
|
+
Compilation,
|
|
24
|
+
Stylelint,
|
|
25
|
+
LintResult,
|
|
26
|
+
LinterResult,
|
|
27
|
+
Formatter,
|
|
28
|
+
FormatterType,
|
|
29
|
+
isPathIgnored,
|
|
30
|
+
Options,
|
|
31
|
+
GenerateReport,
|
|
32
|
+
Report,
|
|
33
|
+
Reporter,
|
|
34
|
+
Linter,
|
|
35
|
+
LintResultMap,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
type Options = import('./options').Options;
|
|
39
|
+
type Compilation = import('webpack').Compilation;
|
|
40
|
+
type Stylelint = import('./getStylelint').Stylelint;
|
|
41
|
+
type Linter = (files: string | string[]) => void;
|
|
42
|
+
type Reporter = () => Promise<Report>;
|
|
43
|
+
import getStylelint = require('./getStylelint');
|
|
44
|
+
type Compiler = import('webpack').Compiler;
|
|
45
|
+
type LintResult = import('./getStylelint').LintResult;
|
|
46
|
+
type LinterResult = import('./getStylelint').LinterResult;
|
|
47
|
+
type Formatter = import('./getStylelint').Formatter;
|
|
48
|
+
type FormatterType = import('./getStylelint').FormatterType;
|
|
49
|
+
type isPathIgnored = import('./getStylelint').isPathIgnored;
|
|
50
|
+
type GenerateReport = (compilation: Compilation) => Promise<void>;
|
|
51
|
+
type Report = {
|
|
52
|
+
errors?: StylelintError;
|
|
53
|
+
warnings?: StylelintError;
|
|
54
|
+
generateReportAsset?: GenerateReport;
|
|
55
|
+
};
|
|
56
|
+
type LintResultMap = {
|
|
57
|
+
[files: string]: import('stylelint').LintResult;
|
|
58
|
+
};
|
|
59
|
+
import StylelintError = require('./StylelintError');
|