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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type StylelintOptions = import('./getStylelint').LinterOptions;
|
|
2
|
+
export type FormatterType = import('./getStylelint').FormatterType;
|
|
3
|
+
export type OutputReport = {
|
|
4
|
+
filePath?: string | undefined;
|
|
5
|
+
formatter?: FormatterType | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type PluginOptions = {
|
|
8
|
+
context: string;
|
|
9
|
+
emitError: boolean;
|
|
10
|
+
emitWarning: boolean;
|
|
11
|
+
exclude?: (string | string[]) | undefined;
|
|
12
|
+
extensions: string | string[];
|
|
13
|
+
failOnError: boolean;
|
|
14
|
+
failOnWarning: boolean;
|
|
15
|
+
files: string | string[];
|
|
16
|
+
formatter: FormatterType;
|
|
17
|
+
lintDirtyModulesOnly: boolean;
|
|
18
|
+
quiet: boolean;
|
|
19
|
+
stylelintPath: string;
|
|
20
|
+
outputReport: OutputReport;
|
|
21
|
+
threads?: (number | boolean) | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type Options = Partial<PluginOptions & StylelintOptions>;
|
|
24
|
+
/** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
|
|
25
|
+
/** @typedef {import('./getStylelint').FormatterType} FormatterType */
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} OutputReport
|
|
28
|
+
* @property {string=} filePath
|
|
29
|
+
* @property {FormatterType=} formatter
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {Object} PluginOptions
|
|
33
|
+
* @property {string} context
|
|
34
|
+
* @property {boolean} emitError
|
|
35
|
+
* @property {boolean} emitWarning
|
|
36
|
+
* @property {string|string[]=} exclude
|
|
37
|
+
* @property {string|string[]} extensions
|
|
38
|
+
* @property {boolean} failOnError
|
|
39
|
+
* @property {boolean} failOnWarning
|
|
40
|
+
* @property {string|string[]} files
|
|
41
|
+
* @property {FormatterType} formatter
|
|
42
|
+
* @property {boolean} lintDirtyModulesOnly
|
|
43
|
+
* @property {boolean} quiet
|
|
44
|
+
* @property {string} stylelintPath
|
|
45
|
+
* @property {OutputReport} outputReport
|
|
46
|
+
* @property {number|boolean=} threads
|
|
47
|
+
*/
|
|
48
|
+
/** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
|
|
49
|
+
/**
|
|
50
|
+
* @param {Options} pluginOptions
|
|
51
|
+
* @returns {Partial<PluginOptions>}
|
|
52
|
+
*/
|
|
53
|
+
export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
|
|
54
|
+
/**
|
|
55
|
+
* @param {Options} pluginOptions
|
|
56
|
+
* @returns {Partial<StylelintOptions>}
|
|
57
|
+
*/
|
|
58
|
+
export function getStylelintOptions(
|
|
59
|
+
pluginOptions: Options
|
|
60
|
+
): Partial<StylelintOptions>;
|
|
@@ -16,4 +16,9 @@ export function parseFoldersToGlobs(
|
|
|
16
16
|
patterns: string | string[],
|
|
17
17
|
extensions?: string | string[]
|
|
18
18
|
): string[];
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param {string} _ key, but unused
|
|
22
|
+
* @param {any} value
|
|
23
|
+
*/
|
|
19
24
|
export function jsonStringifyReplacerSortKeys(_: string, value: any): any;
|
package/declarations/cjs.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/// <reference types="stylelint" />
|
|
2
|
-
/**
|
|
3
|
-
* @param {string|undefined} key
|
|
4
|
-
* @param {Options} options
|
|
5
|
-
* @returns {Linter}
|
|
6
|
-
*/
|
|
7
|
-
export default function getStylelint(
|
|
8
|
-
key: string | undefined,
|
|
9
|
-
{ threads, ...options }: Options
|
|
10
|
-
): Linter;
|
|
11
|
-
export type Stylelint = import('postcss').PluginCreator<
|
|
12
|
-
import('stylelint').PostcssPluginOptions
|
|
13
|
-
> & {
|
|
14
|
-
lint: (
|
|
15
|
-
options: import('stylelint').LinterOptions
|
|
16
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
17
|
-
rules: {
|
|
18
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
19
|
-
};
|
|
20
|
-
formatters: {
|
|
21
|
-
[k: string]: import('stylelint').Formatter;
|
|
22
|
-
};
|
|
23
|
-
createPlugin: (
|
|
24
|
-
ruleName: string,
|
|
25
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
26
|
-
) => {
|
|
27
|
-
ruleName: string;
|
|
28
|
-
rule: import('stylelint').Rule<any, any>;
|
|
29
|
-
};
|
|
30
|
-
createLinter: (
|
|
31
|
-
options: import('stylelint').LinterOptions
|
|
32
|
-
) => import('stylelint').InternalApi;
|
|
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 LintResult = import('stylelint').LintResult;
|
|
58
|
-
export type Options = import('./options').Options;
|
|
59
|
-
export type AsyncTask = () => Promise<void>;
|
|
60
|
-
export type LintTask = (files: string | string[]) => Promise<LintResult[]>;
|
|
61
|
-
export type Worker = JestWorker & {
|
|
62
|
-
lintFiles: LintTask;
|
|
63
|
-
};
|
|
64
|
-
export type Linter = {
|
|
65
|
-
stylelint: Stylelint;
|
|
66
|
-
lintFiles: LintTask;
|
|
67
|
-
cleanup: AsyncTask;
|
|
68
|
-
threads: number;
|
|
69
|
-
};
|
|
70
|
-
import { Worker as JestWorker } from 'jest-worker';
|
package/declarations/linter.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/// <reference types="stylelint" />
|
|
2
|
-
/**
|
|
3
|
-
* @param {string|undefined} key
|
|
4
|
-
* @param {Options} options
|
|
5
|
-
* @param {Compilation} compilation
|
|
6
|
-
* @returns {{lint: Linter, report: Reporter, threads: number}}
|
|
7
|
-
*/
|
|
8
|
-
export default function linter(
|
|
9
|
-
key: string | undefined,
|
|
10
|
-
options: Options,
|
|
11
|
-
compilation: Compilation
|
|
12
|
-
): {
|
|
13
|
-
lint: Linter;
|
|
14
|
-
report: Reporter;
|
|
15
|
-
threads: number;
|
|
16
|
-
};
|
|
17
|
-
export type Stylelint = import('postcss').PluginCreator<
|
|
18
|
-
import('stylelint').PostcssPluginOptions
|
|
19
|
-
> & {
|
|
20
|
-
lint: (
|
|
21
|
-
options: import('stylelint').LinterOptions
|
|
22
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
23
|
-
rules: {
|
|
24
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
25
|
-
};
|
|
26
|
-
formatters: {
|
|
27
|
-
[k: string]: import('stylelint').Formatter;
|
|
28
|
-
};
|
|
29
|
-
createPlugin: (
|
|
30
|
-
ruleName: string,
|
|
31
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
32
|
-
) => {
|
|
33
|
-
ruleName: string;
|
|
34
|
-
rule: import('stylelint').Rule<any, any>;
|
|
35
|
-
};
|
|
36
|
-
createLinter: (
|
|
37
|
-
options: import('stylelint').LinterOptions
|
|
38
|
-
) => import('stylelint').InternalApi;
|
|
39
|
-
utils: {
|
|
40
|
-
report: (problem: import('stylelint').Problem) => void;
|
|
41
|
-
ruleMessages: <
|
|
42
|
-
T extends import('stylelint').RuleMessages,
|
|
43
|
-
R extends { [K in keyof T]: T[K] }
|
|
44
|
-
>(
|
|
45
|
-
ruleName: string,
|
|
46
|
-
messages: T
|
|
47
|
-
) => R;
|
|
48
|
-
validateOptions: (
|
|
49
|
-
result: import('stylelint').PostcssResult,
|
|
50
|
-
ruleName: string,
|
|
51
|
-
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
52
|
-
) => boolean;
|
|
53
|
-
checkAgainstRule: <T_1, O extends Object>(
|
|
54
|
-
options: {
|
|
55
|
-
ruleName: string;
|
|
56
|
-
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
57
|
-
root: import('postcss').Root;
|
|
58
|
-
},
|
|
59
|
-
callback: (warning: import('postcss').Warning) => void
|
|
60
|
-
) => void;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
export type LintResult = import('stylelint').LintResult;
|
|
64
|
-
export type Compiler = import('webpack').Compiler;
|
|
65
|
-
export type Compilation = import('webpack').Compilation;
|
|
66
|
-
export type Options = import('./options').Options;
|
|
67
|
-
export type FormatterType = import('./options').FormatterType;
|
|
68
|
-
export type FormatterFunction = (results: LintResult[]) => string;
|
|
69
|
-
export type GenerateReport = (compilation: Compilation) => Promise<void>;
|
|
70
|
-
export type Report = {
|
|
71
|
-
errors?: StylelintError;
|
|
72
|
-
warnings?: StylelintError;
|
|
73
|
-
generateReportAsset?: GenerateReport;
|
|
74
|
-
};
|
|
75
|
-
export type Reporter = () => Promise<Report>;
|
|
76
|
-
export type Linter = (files: string | string[]) => void;
|
|
77
|
-
export type LintResultMap = {
|
|
78
|
-
[files: string]: import('stylelint').LintResult;
|
|
79
|
-
};
|
|
80
|
-
import StylelintError from './StylelintError';
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/// <reference types="stylelint" />
|
|
2
|
-
/** @typedef {import("stylelint")} stylelint */
|
|
3
|
-
/** @typedef {import("stylelint").LinterOptions} StylelintOptions */
|
|
4
|
-
/** @typedef {import("stylelint").FormatterType} FormatterType */
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {Object} OutputReport
|
|
7
|
-
* @property {string=} filePath
|
|
8
|
-
* @property {FormatterType=} formatter
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* @typedef {Object} PluginOptions
|
|
12
|
-
* @property {string} context
|
|
13
|
-
* @property {boolean} emitError
|
|
14
|
-
* @property {boolean} emitWarning
|
|
15
|
-
* @property {string|string[]=} exclude
|
|
16
|
-
* @property {string|string[]} extensions
|
|
17
|
-
* @property {boolean} failOnError
|
|
18
|
-
* @property {boolean} failOnWarning
|
|
19
|
-
* @property {string|string[]} files
|
|
20
|
-
* @property {FormatterType} formatter
|
|
21
|
-
* @property {boolean} lintDirtyModulesOnly
|
|
22
|
-
* @property {boolean} quiet
|
|
23
|
-
* @property {string} stylelintPath
|
|
24
|
-
* @property {OutputReport} outputReport
|
|
25
|
-
* @property {number|boolean=} threads
|
|
26
|
-
*/
|
|
27
|
-
/** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
|
|
28
|
-
/**
|
|
29
|
-
* @param {Options} pluginOptions
|
|
30
|
-
* @returns {Partial<PluginOptions>}
|
|
31
|
-
*/
|
|
32
|
-
export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
|
|
33
|
-
/**
|
|
34
|
-
* @param {Options} pluginOptions
|
|
35
|
-
* @returns {Partial<StylelintOptions>}
|
|
36
|
-
*/
|
|
37
|
-
export function getStylelintOptions(
|
|
38
|
-
pluginOptions: Options
|
|
39
|
-
): Partial<StylelintOptions>;
|
|
40
|
-
export type stylelint = import('postcss').PluginCreator<
|
|
41
|
-
import('stylelint').PostcssPluginOptions
|
|
42
|
-
> & {
|
|
43
|
-
lint: (
|
|
44
|
-
options: import('stylelint').LinterOptions
|
|
45
|
-
) => Promise<import('stylelint').LinterResult>;
|
|
46
|
-
rules: {
|
|
47
|
-
[k: string]: import('stylelint').Rule<any, any>;
|
|
48
|
-
};
|
|
49
|
-
formatters: {
|
|
50
|
-
[k: string]: import('stylelint').Formatter;
|
|
51
|
-
};
|
|
52
|
-
createPlugin: (
|
|
53
|
-
ruleName: string,
|
|
54
|
-
plugin: import('stylelint').Plugin<any, any>
|
|
55
|
-
) => {
|
|
56
|
-
ruleName: string;
|
|
57
|
-
rule: import('stylelint').Rule<any, any>;
|
|
58
|
-
};
|
|
59
|
-
createLinter: (
|
|
60
|
-
options: import('stylelint').LinterOptions
|
|
61
|
-
) => import('stylelint').InternalApi;
|
|
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
|
-
};
|
|
86
|
-
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
87
|
-
export type FormatterType = import('stylelint').FormatterType;
|
|
88
|
-
export type OutputReport = {
|
|
89
|
-
filePath?: string | undefined;
|
|
90
|
-
formatter?: FormatterType | undefined;
|
|
91
|
-
};
|
|
92
|
-
export type PluginOptions = {
|
|
93
|
-
context: string;
|
|
94
|
-
emitError: boolean;
|
|
95
|
-
emitWarning: boolean;
|
|
96
|
-
exclude?: (string | string[]) | undefined;
|
|
97
|
-
extensions: string | string[];
|
|
98
|
-
failOnError: boolean;
|
|
99
|
-
failOnWarning: boolean;
|
|
100
|
-
files: string | string[];
|
|
101
|
-
formatter: FormatterType;
|
|
102
|
-
lintDirtyModulesOnly: boolean;
|
|
103
|
-
quiet: boolean;
|
|
104
|
-
stylelintPath: string;
|
|
105
|
-
outputReport: OutputReport;
|
|
106
|
-
threads?: (number | boolean) | undefined;
|
|
107
|
-
};
|
|
108
|
-
export type Options = Partial<PluginOptions & StylelintOptions>;
|
package/declarations/worker.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// <reference types="stylelint" />
|
|
2
|
-
export type Stylelint = import('postcss').PluginCreator<
|
|
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
|
-
utils: {
|
|
25
|
-
report: (problem: import('stylelint').Problem) => void;
|
|
26
|
-
ruleMessages: <
|
|
27
|
-
T extends import('stylelint').RuleMessages,
|
|
28
|
-
R extends { [K in keyof T]: T[K] }
|
|
29
|
-
>(
|
|
30
|
-
ruleName: string,
|
|
31
|
-
messages: T
|
|
32
|
-
) => R;
|
|
33
|
-
validateOptions: (
|
|
34
|
-
result: import('stylelint').PostcssResult,
|
|
35
|
-
ruleName: string,
|
|
36
|
-
...optionDescriptions: import('stylelint').RuleOptions[]
|
|
37
|
-
) => boolean;
|
|
38
|
-
checkAgainstRule: <T_1, O extends Object>(
|
|
39
|
-
options: {
|
|
40
|
-
ruleName: string;
|
|
41
|
-
ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
|
|
42
|
-
root: import('postcss').Root;
|
|
43
|
-
},
|
|
44
|
-
callback: (warning: import('postcss').Warning) => void
|
|
45
|
-
) => void;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export type StylelintOptions = import('stylelint').LinterOptions;
|
|
49
|
-
export type Options = import('./options').Options;
|