stylelint-webpack-plugin 5.0.0 → 5.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.
@@ -1,59 +1,107 @@
1
- export type StylelintOptions = import('./getStylelint').LinterOptions;
2
- export type FormatterType = import('./getStylelint').FormatterType;
1
+ export type StylelintOptions = import("./getStylelint").LinterOptions;
2
+ export type FormatterType = import("./getStylelint").FormatterType;
3
3
  export type OutputReport = {
4
+ /**
5
+ * file path
6
+ */
4
7
  filePath?: string | undefined;
8
+ /**
9
+ * formatter
10
+ */
5
11
  formatter?: FormatterType | undefined;
6
12
  };
7
13
  export type PluginOptions = {
14
+ /**
15
+ * a string indicating the root of your files
16
+ */
8
17
  context: string;
18
+ /**
19
+ * the errors found will always be emitted
20
+ */
9
21
  emitError: boolean;
22
+ /**
23
+ * the warnings found will always be emitted
24
+ */
10
25
  emitWarning: boolean;
26
+ /**
27
+ * specify the files and/or directories to exclude
28
+ */
11
29
  exclude?: (string | string[]) | undefined;
30
+ /**
31
+ * specify the extensions that should be checked
32
+ */
12
33
  extensions: string | string[];
34
+ /**
35
+ * will cause the module build to fail if there are any errors
36
+ */
13
37
  failOnError: boolean;
38
+ /**
39
+ * will cause the module build to fail if there are any warning
40
+ */
14
41
  failOnWarning: boolean;
42
+ /**
43
+ * specify directories, files, or globs
44
+ */
15
45
  files: string | string[];
46
+ /**
47
+ * specify the formatter you would like to use to format your results
48
+ */
16
49
  formatter: FormatterType;
50
+ /**
51
+ * lint only changed files, skip linting on start
52
+ */
17
53
  lintDirtyModulesOnly: boolean;
54
+ /**
55
+ * will process and report errors only and ignore warnings
56
+ */
18
57
  quiet: boolean;
58
+ /**
59
+ * path to `stylelint` instance that will be used for linting
60
+ */
19
61
  stylelintPath: string;
62
+ /**
63
+ * writes the output of the errors to a file - for example, a `json` file for use for reporting
64
+ */
20
65
  outputReport: OutputReport;
66
+ /**
67
+ * number of worker threads
68
+ */
21
69
  threads?: (number | boolean) | undefined;
22
70
  };
23
71
  export type Options = Partial<PluginOptions & StylelintOptions>;
24
72
  /** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
25
73
  /** @typedef {import('./getStylelint').FormatterType} FormatterType */
26
74
  /**
27
- * @typedef {Object} OutputReport
28
- * @property {string=} filePath
29
- * @property {FormatterType=} formatter
75
+ * @typedef {object} OutputReport
76
+ * @property {string=} filePath file path
77
+ * @property {FormatterType=} formatter formatter
30
78
  */
31
79
  /**
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
80
+ * @typedef {object} PluginOptions
81
+ * @property {string} context a string indicating the root of your files
82
+ * @property {boolean} emitError the errors found will always be emitted
83
+ * @property {boolean} emitWarning the warnings found will always be emitted
84
+ * @property {string | string[]=} exclude specify the files and/or directories to exclude
85
+ * @property {string | string[]} extensions specify the extensions that should be checked
86
+ * @property {boolean} failOnError will cause the module build to fail if there are any errors
87
+ * @property {boolean} failOnWarning will cause the module build to fail if there are any warning
88
+ * @property {string | string[]} files specify directories, files, or globs
89
+ * @property {FormatterType} formatter specify the formatter you would like to use to format your results
90
+ * @property {boolean} lintDirtyModulesOnly lint only changed files, skip linting on start
91
+ * @property {boolean} quiet will process and report errors only and ignore warnings
92
+ * @property {string} stylelintPath path to `stylelint` instance that will be used for linting
93
+ * @property {OutputReport} outputReport writes the output of the errors to a file - for example, a `json` file for use for reporting
94
+ * @property {number | boolean=} threads number of worker threads
47
95
  */
48
96
  /** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
49
97
  /**
50
- * @param {Options} pluginOptions
51
- * @returns {Partial<PluginOptions>}
98
+ * @param {Options} pluginOptions plugin options
99
+ * @returns {Partial<PluginOptions>} partial plugin options
52
100
  */
53
101
  export function getOptions(pluginOptions: Options): Partial<PluginOptions>;
54
102
  /**
55
- * @param {Options} pluginOptions
56
- * @returns {Partial<StylelintOptions>}
103
+ * @param {Options} pluginOptions plugin options
104
+ * @returns {Partial<StylelintOptions>} stylelint options
57
105
  */
58
106
  export function getStylelintOptions(
59
107
  pluginOptions: Options,
package/types/utils.d.ts CHANGED
@@ -1,21 +1,4 @@
1
- /**
2
- * @template T
3
- * @param {T} value
4
- * @return {
5
- T extends (null | undefined)
6
- ? []
7
- : T extends string
8
- ? [string]
9
- : T extends readonly unknown[]
10
- ? T
11
- : T extends Iterable<infer T>
12
- ? T[]
13
- : [T]
14
- }
15
- */
16
- export function arrify<T>(
17
- value: T,
18
- ): T extends null | undefined
1
+ export type ArrifyResult<T> = T extends null | undefined
19
2
  ? []
20
3
  : T extends string
21
4
  ? [string]
@@ -24,24 +7,48 @@ export function arrify<T>(
24
7
  : T extends Iterable<infer T_1>
25
8
  ? T_1[]
26
9
  : [T];
10
+ export type EXPECTED_ANY = any;
11
+ /**
12
+ * @template T
13
+ * @typedef {T extends (null | undefined)
14
+ * ? []
15
+ * : T extends string
16
+ * ? [string]
17
+ * : T extends readonly unknown[]
18
+ * ? T
19
+ * : T extends Iterable<infer T>
20
+ * ? T[]
21
+ * : [T]} ArrifyResult
22
+ */
27
23
  /**
28
- * @param {string|string[]} files
29
- * @param {string} context
30
- * @returns {string[]}
24
+ * @template T
25
+ * @param {T} value value
26
+ * @returns {ArrifyResult<T>} array of values
27
+ */
28
+ export function arrify<T>(value: T): ArrifyResult<T>;
29
+ /**
30
+ * @param {string} _ key, but unused
31
+ * @param {EXPECTED_ANY} value value
32
+ * @returns {{ [x: string]: EXPECTED_ANY }} result
33
+ */
34
+ export function jsonStringifyReplacerSortKeys(
35
+ _: string,
36
+ value: EXPECTED_ANY,
37
+ ): {
38
+ [x: string]: EXPECTED_ANY;
39
+ };
40
+ /**
41
+ * @param {string | string[]} files files
42
+ * @param {string} context context
43
+ * @returns {string[]} normalized paths
31
44
  */
32
45
  export function parseFiles(files: string | string[], context: string): string[];
33
46
  /**
34
- * @param {string|string[]} patterns
35
- * @param {string|string[]} extensions
36
- * @returns {string[]}
47
+ * @param {string | string[]} patterns patterns
48
+ * @param {string | string[]} extensions extensions
49
+ * @returns {string[]} globs
37
50
  */
38
51
  export function parseFoldersToGlobs(
39
52
  patterns: string | string[],
40
53
  extensions?: string | string[],
41
54
  ): string[];
42
- /**
43
- *
44
- * @param {string} _ key, but unused
45
- * @param {any} value
46
- */
47
- export function jsonStringifyReplacerSortKeys(_: string, value: any): any;
package/types/worker.d.ts CHANGED
@@ -1,3 +1,22 @@
1
- export type Stylelint = import('./getStylelint').Stylelint;
2
- export type StylelintOptions = import('./getStylelint').LinterOptions;
3
- export type Options = import('./options').Options;
1
+ export type Stylelint = import("./getStylelint").Stylelint;
2
+ export type StylelintOptions = import("./getStylelint").LinterOptions;
3
+ export type LintResult = import("./getStylelint").LintResult;
4
+ export type Options = import("./options").Options;
5
+ /**
6
+ * Lazily load stylelint on first use
7
+ * @returns {Promise<Stylelint>} stylelint instance
8
+ */
9
+ export function getStylelint(): Promise<Stylelint>;
10
+ /**
11
+ * @param {string | string[]} files files
12
+ * @returns {Promise<LintResult[]>} results
13
+ */
14
+ export function lintFiles(files: string | string[]): Promise<LintResult[]>;
15
+ /**
16
+ * @param {Options} options the worker options
17
+ * @param {Partial<StylelintOptions>} stylelintOptions the stylelint options
18
+ */
19
+ export function setup(
20
+ options: Options,
21
+ stylelintOptions: Partial<StylelintOptions>,
22
+ ): void;