stylelint-webpack-plugin 3.3.0 → 4.1.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/README.md +9 -6
- package/dist/StylelintError.js +0 -2
- package/dist/getStylelint.js +32 -37
- package/dist/index.js +25 -44
- package/dist/linter.js +77 -86
- package/dist/options.js +12 -16
- package/dist/options.json +1 -1
- package/dist/utils.js +13 -31
- package/dist/worker.js +11 -11
- package/package.json +26 -22
- package/types/getStylelint.d.ts +16 -52
- package/types/linter.d.ts +16 -66
- package/types/options.d.ts +4 -61
- package/types/worker.d.ts +2 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylelint-webpack-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "A Stylelint plugin for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/stylelint-webpack-plugin",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"types": "types/index.d.ts",
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">= 14.15.0"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"start": "npm run build -- -w",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"security": "npm audit",
|
|
28
28
|
"lint:prettier": "prettier -w --list-different .",
|
|
29
29
|
"lint:js": "eslint --cache .",
|
|
30
|
+
"lint:spelling": "cspell \"**/*.*\"",
|
|
30
31
|
"lint:types": "tsc --pretty --noEmit",
|
|
31
32
|
"lint": "npm-run-all -l -p \"lint:**\"",
|
|
32
33
|
"test:only": "cross-env NODE_ENV=test jest --testTimeout=60000",
|
|
@@ -42,48 +43,51 @@
|
|
|
42
43
|
"types"
|
|
43
44
|
],
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"stylelint": "^13.0.0 || ^14.0.0",
|
|
46
|
+
"stylelint": "^13.0.0 || ^14.0.0 || ^15.0.0",
|
|
46
47
|
"webpack": "^5.0.0"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"jest-worker": "^28.1.0",
|
|
50
50
|
"globby": "^11.1.0",
|
|
51
|
+
"jest-worker": "^29.4.2",
|
|
51
52
|
"micromatch": "^4.0.5",
|
|
52
53
|
"normalize-path": "^3.0.0",
|
|
53
54
|
"schema-utils": "^4.0.0"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@babel/cli": "^7.
|
|
57
|
-
"@babel/core": "^7.
|
|
58
|
-
"@babel/preset-env": "^7.
|
|
59
|
-
"@commitlint/cli": "^
|
|
60
|
-
"@commitlint/config-conventional": "^
|
|
57
|
+
"@babel/cli": "^7.20.7",
|
|
58
|
+
"@babel/core": "^7.20.12",
|
|
59
|
+
"@babel/preset-env": "^7.20.2",
|
|
60
|
+
"@commitlint/cli": "^17.4.2",
|
|
61
|
+
"@commitlint/config-conventional": "^17.4.2",
|
|
62
|
+
"@types/file-entry-cache": "^5.0.2",
|
|
61
63
|
"@types/fs-extra": "^9.0.13",
|
|
62
64
|
"@types/micromatch": "^4.0.2",
|
|
65
|
+
"@types/node": "^18.13.0",
|
|
63
66
|
"@types/normalize-path": "^3.0.0",
|
|
64
67
|
"@types/webpack": "^5.28.0",
|
|
65
68
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
66
69
|
"babel-eslint": "^10.1.0",
|
|
67
|
-
"babel-jest": "^
|
|
70
|
+
"babel-jest": "^29.4.2",
|
|
68
71
|
"chokidar": "^3.5.3",
|
|
69
72
|
"cross-env": "^7.0.3",
|
|
70
|
-
"
|
|
73
|
+
"cspell": "^6.22.0",
|
|
74
|
+
"del": "^6.1.1",
|
|
71
75
|
"del-cli": "^4.0.1",
|
|
72
|
-
"eslint": "^8.
|
|
73
|
-
"eslint-config-prettier": "^8.
|
|
74
|
-
"eslint-plugin-import": "^2.
|
|
76
|
+
"eslint": "^8.34.0",
|
|
77
|
+
"eslint-config-prettier": "^8.6.0",
|
|
78
|
+
"eslint-plugin-import": "^2.27.5",
|
|
75
79
|
"file-loader": "^6.2.0",
|
|
76
80
|
"fs-extra": "^10.1.0",
|
|
77
|
-
"husky": "^
|
|
78
|
-
"jest": "^
|
|
79
|
-
"lint-staged": "^
|
|
81
|
+
"husky": "^8.0.3",
|
|
82
|
+
"jest": "^29.4.2",
|
|
83
|
+
"lint-staged": "^13.1.1",
|
|
80
84
|
"npm-run-all": "^4.1.5",
|
|
81
|
-
"postcss-scss": "^4.0.
|
|
82
|
-
"prettier": "^2.
|
|
85
|
+
"postcss-scss": "^4.0.6",
|
|
86
|
+
"prettier": "^2.8.4",
|
|
83
87
|
"standard-version": "^9.5.0",
|
|
84
|
-
"stylelint": "^
|
|
85
|
-
"typescript": "^4.
|
|
86
|
-
"webpack": "^5.
|
|
88
|
+
"stylelint": "^15.0.0",
|
|
89
|
+
"typescript": "^4.9.5",
|
|
90
|
+
"webpack": "^5.75.0"
|
|
87
91
|
},
|
|
88
92
|
"keywords": [
|
|
89
93
|
"stylelint",
|
package/types/getStylelint.d.ts
CHANGED
|
@@ -13,7 +13,12 @@ declare namespace getStylelint {
|
|
|
13
13
|
export {
|
|
14
14
|
Stylelint,
|
|
15
15
|
LintResult,
|
|
16
|
+
LinterOptions,
|
|
17
|
+
LinterResult,
|
|
18
|
+
Formatter,
|
|
19
|
+
FormatterType,
|
|
16
20
|
Options,
|
|
21
|
+
isPathIgnored,
|
|
17
22
|
AsyncTask,
|
|
18
23
|
LintTask,
|
|
19
24
|
Linter,
|
|
@@ -22,68 +27,27 @@ declare namespace getStylelint {
|
|
|
22
27
|
}
|
|
23
28
|
type Options = import('./options').Options;
|
|
24
29
|
type Linter = {
|
|
25
|
-
api: import('stylelint').InternalApi;
|
|
26
30
|
stylelint: Stylelint;
|
|
31
|
+
isPathIgnored: isPathIgnored;
|
|
27
32
|
lintFiles: LintTask;
|
|
28
33
|
cleanup: AsyncTask;
|
|
29
34
|
threads: number;
|
|
30
35
|
};
|
|
31
|
-
type Stylelint =
|
|
32
|
-
|
|
33
|
-
> & {
|
|
34
|
-
lint: (
|
|
35
|
-
options: import('stylelint').LinterOptions
|
|
36
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
37
|
-
rules: {
|
|
38
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
39
|
-
};
|
|
36
|
+
type Stylelint = {
|
|
37
|
+
lint: (options: LinterOptions) => Promise<LinterResult>;
|
|
40
38
|
formatters: {
|
|
41
39
|
[k: string]: import('stylelint').Formatter;
|
|
42
40
|
};
|
|
43
|
-
createPlugin: (
|
|
44
|
-
ruleName: string,
|
|
45
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
46
|
-
) => {
|
|
47
|
-
ruleName: string;
|
|
48
|
-
rule: import('stylelint').Rule<any, any>;
|
|
49
|
-
};
|
|
50
|
-
createLinter: (
|
|
51
|
-
options: import('stylelint').LinterOptions
|
|
52
|
-
) => import('stylelint').InternalApi;
|
|
53
|
-
resolveConfig: (
|
|
54
|
-
filePath: string,
|
|
55
|
-
options?:
|
|
56
|
-
| Pick<
|
|
57
|
-
import('stylelint').LinterOptions,
|
|
58
|
-
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
59
|
-
>
|
|
60
|
-
| undefined
|
|
61
|
-
) => Promise<import('stylelint').Config | undefined>;
|
|
62
|
-
utils: {
|
|
63
|
-
report: (problem: import('stylelint').Problem) => void;
|
|
64
|
-
ruleMessages: <
|
|
65
|
-
T extends import('stylelint').RuleMessages,
|
|
66
|
-
R extends { [K in keyof T]: T[K] }
|
|
67
|
-
>(
|
|
68
|
-
ruleName: string,
|
|
69
|
-
messages: T
|
|
70
|
-
) => R;
|
|
71
|
-
validateOptions: (
|
|
72
|
-
result: import('stylelint').PostcssResult,
|
|
73
|
-
ruleName: string,
|
|
74
|
-
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
75
|
-
) => boolean;
|
|
76
|
-
checkAgainstRule: <T_1, O extends Object>(
|
|
77
|
-
options: {
|
|
78
|
-
ruleName: string;
|
|
79
|
-
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
80
|
-
root: import('postcss').Root;
|
|
81
|
-
},
|
|
82
|
-
callback: (warning: import('postcss').Warning) => void
|
|
83
|
-
) => void;
|
|
84
|
-
};
|
|
85
41
|
};
|
|
86
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>;
|
|
87
51
|
type AsyncTask = () => Promise<void>;
|
|
88
52
|
type LintTask = (files: string | string[]) => Promise<LintResult[]>;
|
|
89
53
|
type Worker = JestWorker & {
|
package/types/linter.d.ts
CHANGED
|
@@ -4,28 +4,30 @@ export = linter;
|
|
|
4
4
|
* @param {string|undefined} key
|
|
5
5
|
* @param {Options} options
|
|
6
6
|
* @param {Compilation} compilation
|
|
7
|
-
* @returns {{
|
|
7
|
+
* @returns {{stylelint: Stylelint, isPathIgnored: isPathIgnored, lint: Linter, report: Reporter, threads: number}}
|
|
8
8
|
*/
|
|
9
9
|
declare function linter(
|
|
10
10
|
key: string | undefined,
|
|
11
11
|
options: Options,
|
|
12
12
|
compilation: Compilation
|
|
13
13
|
): {
|
|
14
|
-
|
|
14
|
+
stylelint: Stylelint;
|
|
15
|
+
isPathIgnored: getStylelint.isPathIgnored;
|
|
15
16
|
lint: Linter;
|
|
16
17
|
report: Reporter;
|
|
17
18
|
threads: number;
|
|
18
19
|
};
|
|
19
20
|
declare namespace linter {
|
|
20
21
|
export {
|
|
21
|
-
Stylelint,
|
|
22
|
-
LintResult,
|
|
23
|
-
InternalApi,
|
|
24
22
|
Compiler,
|
|
25
23
|
Compilation,
|
|
26
|
-
|
|
24
|
+
Stylelint,
|
|
25
|
+
LintResult,
|
|
26
|
+
LinterResult,
|
|
27
|
+
Formatter,
|
|
27
28
|
FormatterType,
|
|
28
|
-
|
|
29
|
+
isPathIgnored,
|
|
30
|
+
Options,
|
|
29
31
|
GenerateReport,
|
|
30
32
|
Report,
|
|
31
33
|
Reporter,
|
|
@@ -35,68 +37,16 @@ declare namespace linter {
|
|
|
35
37
|
}
|
|
36
38
|
type Options = import('./options').Options;
|
|
37
39
|
type Compilation = import('webpack').Compilation;
|
|
38
|
-
type
|
|
40
|
+
type Stylelint = import('./getStylelint').Stylelint;
|
|
39
41
|
type Linter = (files: string | string[]) => void;
|
|
40
42
|
type Reporter = () => Promise<Report>;
|
|
41
|
-
|
|
42
|
-
import('stylelint').PostcssPluginOptions
|
|
43
|
-
> & {
|
|
44
|
-
lint: (
|
|
45
|
-
options: import('stylelint').LinterOptions
|
|
46
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
47
|
-
rules: {
|
|
48
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
49
|
-
};
|
|
50
|
-
formatters: {
|
|
51
|
-
[k: string]: import('stylelint').Formatter;
|
|
52
|
-
};
|
|
53
|
-
createPlugin: (
|
|
54
|
-
ruleName: string,
|
|
55
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
56
|
-
) => {
|
|
57
|
-
ruleName: string;
|
|
58
|
-
rule: import('stylelint').Rule<any, any>;
|
|
59
|
-
};
|
|
60
|
-
createLinter: (
|
|
61
|
-
options: import('stylelint').LinterOptions
|
|
62
|
-
) => import('stylelint').InternalApi;
|
|
63
|
-
resolveConfig: (
|
|
64
|
-
filePath: string,
|
|
65
|
-
options?:
|
|
66
|
-
| Pick<
|
|
67
|
-
import('stylelint').LinterOptions,
|
|
68
|
-
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
69
|
-
>
|
|
70
|
-
| undefined
|
|
71
|
-
) => Promise<import('stylelint').Config | undefined>;
|
|
72
|
-
utils: {
|
|
73
|
-
report: (problem: import('stylelint').Problem) => void;
|
|
74
|
-
ruleMessages: <
|
|
75
|
-
T extends import('stylelint').RuleMessages,
|
|
76
|
-
R extends { [K in keyof T]: T[K] }
|
|
77
|
-
>(
|
|
78
|
-
ruleName: string,
|
|
79
|
-
messages: T
|
|
80
|
-
) => R;
|
|
81
|
-
validateOptions: (
|
|
82
|
-
result: import('stylelint').PostcssResult,
|
|
83
|
-
ruleName: string,
|
|
84
|
-
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
85
|
-
) => boolean;
|
|
86
|
-
checkAgainstRule: <T_1, O extends Object>(
|
|
87
|
-
options: {
|
|
88
|
-
ruleName: string;
|
|
89
|
-
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
90
|
-
root: import('postcss').Root;
|
|
91
|
-
},
|
|
92
|
-
callback: (warning: import('postcss').Warning) => void
|
|
93
|
-
) => void;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
type LintResult = import('stylelint').LintResult;
|
|
43
|
+
import getStylelint = require('./getStylelint');
|
|
97
44
|
type Compiler = import('webpack').Compiler;
|
|
98
|
-
type
|
|
99
|
-
type
|
|
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;
|
|
100
50
|
type GenerateReport = (compilation: Compilation) => Promise<void>;
|
|
101
51
|
type Report = {
|
|
102
52
|
errors?: StylelintError;
|
package/types/options.d.ts
CHANGED
|
@@ -1,61 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
import('stylelint').PostcssPluginOptions
|
|
4
|
-
> & {
|
|
5
|
-
lint: (
|
|
6
|
-
options: import('stylelint').LinterOptions
|
|
7
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
8
|
-
rules: {
|
|
9
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
10
|
-
};
|
|
11
|
-
formatters: {
|
|
12
|
-
[k: string]: import('stylelint').Formatter;
|
|
13
|
-
};
|
|
14
|
-
createPlugin: (
|
|
15
|
-
ruleName: string,
|
|
16
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
17
|
-
) => {
|
|
18
|
-
ruleName: string;
|
|
19
|
-
rule: import('stylelint').Rule<any, any>;
|
|
20
|
-
};
|
|
21
|
-
createLinter: (
|
|
22
|
-
options: import('stylelint').LinterOptions
|
|
23
|
-
) => import('stylelint').InternalApi;
|
|
24
|
-
resolveConfig: (
|
|
25
|
-
filePath: string,
|
|
26
|
-
options?:
|
|
27
|
-
| Pick<
|
|
28
|
-
import('stylelint').LinterOptions,
|
|
29
|
-
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
30
|
-
>
|
|
31
|
-
| undefined
|
|
32
|
-
) => Promise<import('stylelint').Config | undefined>;
|
|
33
|
-
utils: {
|
|
34
|
-
report: (problem: import('stylelint').Problem) => void;
|
|
35
|
-
ruleMessages: <
|
|
36
|
-
T extends import('stylelint').RuleMessages,
|
|
37
|
-
R extends { [K in keyof T]: T[K] }
|
|
38
|
-
>(
|
|
39
|
-
ruleName: string,
|
|
40
|
-
messages: T
|
|
41
|
-
) => R;
|
|
42
|
-
validateOptions: (
|
|
43
|
-
result: import('stylelint').PostcssResult,
|
|
44
|
-
ruleName: string,
|
|
45
|
-
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
46
|
-
) => boolean;
|
|
47
|
-
checkAgainstRule: <T_1, O extends Object>(
|
|
48
|
-
options: {
|
|
49
|
-
ruleName: string;
|
|
50
|
-
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
51
|
-
root: import('postcss').Root;
|
|
52
|
-
},
|
|
53
|
-
callback: (warning: import('postcss').Warning) => void
|
|
54
|
-
) => void;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
58
|
-
export type FormatterType = import('stylelint').FormatterType;
|
|
1
|
+
export type StylelintOptions = import('./getStylelint').LinterOptions;
|
|
2
|
+
export type FormatterType = import('./getStylelint').FormatterType;
|
|
59
3
|
export type OutputReport = {
|
|
60
4
|
filePath?: string | undefined;
|
|
61
5
|
formatter?: FormatterType | undefined;
|
|
@@ -77,9 +21,8 @@ export type PluginOptions = {
|
|
|
77
21
|
threads?: (number | boolean) | undefined;
|
|
78
22
|
};
|
|
79
23
|
export type Options = Partial<PluginOptions & StylelintOptions>;
|
|
80
|
-
/** @typedef {import(
|
|
81
|
-
/** @typedef {import(
|
|
82
|
-
/** @typedef {import("stylelint").FormatterType} FormatterType */
|
|
24
|
+
/** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
|
|
25
|
+
/** @typedef {import('./getStylelint').FormatterType} FormatterType */
|
|
83
26
|
/**
|
|
84
27
|
* @typedef {Object} OutputReport
|
|
85
28
|
* @property {string=} filePath
|
package/types/worker.d.ts
CHANGED
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
import('stylelint').PostcssPluginOptions
|
|
4
|
-
> & {
|
|
5
|
-
lint: (
|
|
6
|
-
options: import('stylelint').LinterOptions
|
|
7
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
8
|
-
rules: {
|
|
9
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
10
|
-
};
|
|
11
|
-
formatters: {
|
|
12
|
-
[k: string]: import('stylelint').Formatter;
|
|
13
|
-
};
|
|
14
|
-
createPlugin: (
|
|
15
|
-
ruleName: string,
|
|
16
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
17
|
-
) => {
|
|
18
|
-
ruleName: string;
|
|
19
|
-
rule: import('stylelint').Rule<any, any>;
|
|
20
|
-
};
|
|
21
|
-
createLinter: (
|
|
22
|
-
options: import('stylelint').LinterOptions
|
|
23
|
-
) => import('stylelint').InternalApi;
|
|
24
|
-
resolveConfig: (
|
|
25
|
-
filePath: string,
|
|
26
|
-
options?:
|
|
27
|
-
| Pick<
|
|
28
|
-
import('stylelint').LinterOptions,
|
|
29
|
-
'cwd' | 'config' | 'configFile' | 'configBasedir'
|
|
30
|
-
>
|
|
31
|
-
| undefined
|
|
32
|
-
) => Promise<import('stylelint').Config | undefined>;
|
|
33
|
-
utils: {
|
|
34
|
-
report: (problem: import('stylelint').Problem) => void;
|
|
35
|
-
ruleMessages: <
|
|
36
|
-
T extends import('stylelint').RuleMessages,
|
|
37
|
-
R extends { [K in keyof T]: T[K] }
|
|
38
|
-
>(
|
|
39
|
-
ruleName: string,
|
|
40
|
-
messages: T
|
|
41
|
-
) => R;
|
|
42
|
-
validateOptions: (
|
|
43
|
-
result: import('stylelint').PostcssResult,
|
|
44
|
-
ruleName: string,
|
|
45
|
-
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
46
|
-
) => boolean;
|
|
47
|
-
checkAgainstRule: <T_1, O extends Object>(
|
|
48
|
-
options: {
|
|
49
|
-
ruleName: string;
|
|
50
|
-
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
51
|
-
root: import('postcss').Root;
|
|
52
|
-
},
|
|
53
|
-
callback: (warning: import('postcss').Warning) => void
|
|
54
|
-
) => void;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
1
|
+
export type Stylelint = import('./getStylelint').Stylelint;
|
|
2
|
+
export type StylelintOptions = import('./getStylelint').LinterOptions;
|
|
58
3
|
export type Options = import('./options').Options;
|