stylelint-webpack-plugin 4.0.0 → 4.1.1

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 CHANGED
@@ -76,6 +76,30 @@ module.exports = {
76
76
 
77
77
  See [stylelint's options](https://stylelint.io/user-guide/usage/node-api#options) for the complete list of options available. These options are passed through to the `stylelint` directly.
78
78
 
79
+ ### `cache`
80
+
81
+ - Type:
82
+
83
+ ```ts
84
+ type cache = boolean;
85
+ ```
86
+
87
+ - Default: `true`
88
+
89
+ The cache is enabled by default to decrease execution time.
90
+
91
+ ### `cacheLocation`
92
+
93
+ - Type:
94
+
95
+ ```ts
96
+ type cacheLocation = string;
97
+ ```
98
+
99
+ - Default: `node_modules/.cache/stylelint-webpack-plugin/.stylelintcache`
100
+
101
+ Specify the path to the cache location. Can be a file or a directory.
102
+
79
103
  ### `configFile`
80
104
 
81
105
  - Type:
@@ -22,8 +22,12 @@ const {
22
22
  /** @type {{[key: string]: any}} */
23
23
  const cache = {};
24
24
 
25
- /** @typedef {import('stylelint')} Stylelint */
25
+ /** @typedef {{lint: (options: LinterOptions) => Promise<LinterResult>, formatters: { [k: string]: Formatter }}} Stylelint */
26
26
  /** @typedef {import('stylelint').LintResult} LintResult */
27
+ /** @typedef {import('stylelint').LinterOptions} LinterOptions */
28
+ /** @typedef {import('stylelint').LinterResult} LinterResult */
29
+ /** @typedef {import('stylelint').Formatter} Formatter */
30
+ /** @typedef {import('stylelint').FormatterType} FormatterType */
27
31
  /** @typedef {import('./options').Options} Options */
28
32
  /** @typedef {(stylelint: Stylelint, filePath: string) => Promise<boolean>} isPathIgnored */
29
33
  /** @typedef {() => Promise<void>} AsyncTask */
package/dist/index.js CHANGED
@@ -89,7 +89,7 @@ class StylelintWebpackPlugin {
89
89
  return;
90
90
  }
91
91
  compiler.hooks.thisCompilation.tap(this.key, compilation => {
92
- /** @type {import('stylelint')} */
92
+ /** @type {import('./getStylelint').Stylelint} */
93
93
  let stylelint;
94
94
 
95
95
  /** @type {import('./linter').Linter} */
package/dist/linter.js CHANGED
@@ -11,15 +11,15 @@ const {
11
11
  arrify
12
12
  } = require('./utils');
13
13
 
14
- /** @typedef {import('stylelint')} Stylelint */
15
- /** @typedef {import('stylelint').LintResult} LintResult */
16
- /** @typedef {import('stylelint').LinterResult} LinterResult */
17
- /** @typedef {import('stylelint').Formatter} Formatter */
18
- /** @typedef {import('stylelint').FormatterType} FormatterType */
19
14
  /** @typedef {import('webpack').Compiler} Compiler */
20
15
  /** @typedef {import('webpack').Compilation} Compilation */
21
- /** @typedef {import('./options').Options} Options */
16
+ /** @typedef {import('./getStylelint').Stylelint} Stylelint */
17
+ /** @typedef {import('./getStylelint').LintResult} LintResult */
18
+ /** @typedef {import('./getStylelint').LinterResult} LinterResult */
19
+ /** @typedef {import('./getStylelint').Formatter} Formatter */
20
+ /** @typedef {import('./getStylelint').FormatterType} FormatterType */
22
21
  /** @typedef {import('./getStylelint').isPathIgnored} isPathIgnored */
22
+ /** @typedef {import('./options').Options} Options */
23
23
  /** @typedef {(compilation: Compilation) => Promise<void>} GenerateReport */
24
24
  /** @typedef {{errors?: StylelintError, warnings?: StylelintError, generateReportAsset?: GenerateReport}} Report */
25
25
  /** @typedef {() => Promise<Report>} Reporter */
package/dist/options.js CHANGED
@@ -5,9 +5,8 @@ const {
5
5
  } = require('schema-utils');
6
6
  const schema = require('./options.json');
7
7
 
8
- /** @typedef {import("stylelint")} stylelint */
9
- /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
10
- /** @typedef {import("stylelint").FormatterType} FormatterType */
8
+ /** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
9
+ /** @typedef {import('./getStylelint').FormatterType} FormatterType */
11
10
 
12
11
  /**
13
12
  * @typedef {Object} OutputReport
@@ -41,6 +40,8 @@ const schema = require('./options.json');
41
40
  */
42
41
  function getOptions(pluginOptions) {
43
42
  const options = {
43
+ cache: true,
44
+ cacheLocation: 'node_modules/.cache/stylelint-webpack-plugin/.stylelintcache',
44
45
  extensions: ['css', 'scss', 'sass'],
45
46
  emitError: true,
46
47
  emitWarning: true,
package/dist/worker.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- /** @typedef {import('stylelint')} Stylelint */
4
- /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
3
+ /** @typedef {import('./getStylelint').Stylelint} Stylelint */
4
+ /** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
5
5
  /** @typedef {import('./options').Options} Options */
6
6
 
7
7
  Object.assign(module.exports, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stylelint-webpack-plugin",
3
- "version": "4.0.0",
3
+ "version": "4.1.1",
4
4
  "description": "A Stylelint plugin for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/stylelint-webpack-plugin",
@@ -43,51 +43,51 @@
43
43
  "types"
44
44
  ],
45
45
  "peerDependencies": {
46
- "stylelint": "^13.0.0 || ^14.0.0",
46
+ "stylelint": "^13.0.0 || ^14.0.0 || ^15.0.0",
47
47
  "webpack": "^5.0.0"
48
48
  },
49
49
  "dependencies": {
50
50
  "globby": "^11.1.0",
51
- "jest-worker": "^29.4.1",
51
+ "jest-worker": "^29.5.0",
52
52
  "micromatch": "^4.0.5",
53
53
  "normalize-path": "^3.0.0",
54
54
  "schema-utils": "^4.0.0"
55
55
  },
56
56
  "devDependencies": {
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",
57
+ "@babel/cli": "^7.21.0",
58
+ "@babel/core": "^7.21.4",
59
+ "@babel/preset-env": "^7.21.4",
60
+ "@commitlint/cli": "^17.5.1",
61
+ "@commitlint/config-conventional": "^17.4.4",
62
62
  "@types/file-entry-cache": "^5.0.2",
63
63
  "@types/fs-extra": "^9.0.13",
64
64
  "@types/micromatch": "^4.0.2",
65
- "@types/node": "^18.11.18",
65
+ "@types/node": "^18.15.11",
66
66
  "@types/normalize-path": "^3.0.0",
67
- "@types/webpack": "^5.28.0",
67
+ "@types/webpack": "^5.28.1",
68
68
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
69
69
  "babel-eslint": "^10.1.0",
70
- "babel-jest": "^29.4.1",
70
+ "babel-jest": "^29.5.0",
71
71
  "chokidar": "^3.5.3",
72
72
  "cross-env": "^7.0.3",
73
- "cspell": "^6.20.1",
73
+ "cspell": "^6.31.1",
74
74
  "del": "^6.1.1",
75
75
  "del-cli": "^4.0.1",
76
- "eslint": "^8.33.0",
77
- "eslint-config-prettier": "^8.6.0",
76
+ "eslint": "^8.38.0",
77
+ "eslint-config-prettier": "^8.8.0",
78
78
  "eslint-plugin-import": "^2.27.5",
79
79
  "file-loader": "^6.2.0",
80
80
  "fs-extra": "^10.1.0",
81
81
  "husky": "^8.0.3",
82
- "jest": "^29.4.1",
83
- "lint-staged": "^13.1.0",
82
+ "jest": "^29.5.0",
83
+ "lint-staged": "^13.2.1",
84
84
  "npm-run-all": "^4.1.5",
85
85
  "postcss-scss": "^4.0.6",
86
- "prettier": "^2.8.3",
86
+ "prettier": "^2.8.7",
87
87
  "standard-version": "^9.5.0",
88
- "stylelint": "^14.16.1",
89
- "typescript": "^4.9.5",
90
- "webpack": "^5.75.0"
88
+ "stylelint": "^15.4.0",
89
+ "typescript": "^5.0.4",
90
+ "webpack": "^5.78.0"
91
91
  },
92
92
  "keywords": [
93
93
  "stylelint",
@@ -1,4 +1,3 @@
1
- /// <reference types="stylelint" />
2
1
  export = getStylelint;
3
2
  /**
4
3
  * @param {string|undefined} key
@@ -13,6 +12,10 @@ declare namespace getStylelint {
13
12
  export {
14
13
  Stylelint,
15
14
  LintResult,
15
+ LinterOptions,
16
+ LinterResult,
17
+ Formatter,
18
+ FormatterType,
16
19
  Options,
17
20
  isPathIgnored,
18
21
  AsyncTask,
@@ -29,67 +32,17 @@ type Linter = {
29
32
  cleanup: AsyncTask;
30
33
  threads: number;
31
34
  };
32
- type Stylelint = import('postcss').PluginCreator<
33
- import('stylelint').PostcssPluginOptions
34
- > & {
35
- lint: (
36
- options: import('stylelint').LinterOptions
37
- ) => Promise<import('stylelint').LinterResult>;
38
- rules: {
39
- [k: string]: import('stylelint').Rule<any, any>;
40
- };
35
+ type Stylelint = {
36
+ lint: (options: LinterOptions) => Promise<LinterResult>;
41
37
  formatters: {
42
38
  [k: string]: import('stylelint').Formatter;
43
39
  };
44
- createPlugin: (
45
- ruleName: string,
46
- rule: import('stylelint').Rule<any, any>
47
- ) => {
48
- ruleName: string;
49
- rule: import('stylelint').Rule<any, any>;
50
- };
51
- createLinter: (
52
- options: import('stylelint').LinterOptions
53
- ) => import('stylelint').InternalApi;
54
- resolveConfig: (
55
- filePath: string,
56
- options?:
57
- | Pick<
58
- import('stylelint').LinterOptions,
59
- 'cwd' | 'config' | 'configFile' | 'configBasedir'
60
- >
61
- | undefined
62
- ) => Promise<import('stylelint').Config | undefined>;
63
- utils: {
64
- report: (problem: import('stylelint').Problem) => void;
65
- ruleMessages: <
66
- T extends import('stylelint').RuleMessages,
67
- R extends { [K in keyof T]: T[K] }
68
- >(
69
- ruleName: string,
70
- messages: T
71
- ) => R;
72
- validateOptions: (
73
- result: import('stylelint').PostcssResult,
74
- ruleName: string,
75
- ...optionDescriptions: import('stylelint').RuleOptions[]
76
- ) => boolean;
77
- checkAgainstRule: <T_1, O extends Object>(
78
- options: {
79
- ruleName: string;
80
- ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
81
- root: import('postcss').Root;
82
- result?: import('stylelint').PostcssResult | undefined;
83
- context?: import('stylelint').RuleContext | undefined;
84
- },
85
- callback: (warning: import('postcss').Warning) => void
86
- ) => void;
87
- };
88
- reference: {
89
- longhandSubPropertiesOfShorthandProperties: import('stylelint').LonghandSubPropertiesOfShorthandProperties;
90
- };
91
40
  };
92
41
  type LintResult = import('stylelint').LintResult;
42
+ type LinterOptions = import('stylelint').LinterOptions;
43
+ type LinterResult = import('stylelint').LinterResult;
44
+ type Formatter = import('stylelint').Formatter;
45
+ type FormatterType = import('stylelint').FormatterType;
93
46
  type isPathIgnored = (
94
47
  stylelint: Stylelint,
95
48
  filePath: string
package/types/linter.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="stylelint" />
2
1
  export = linter;
3
2
  /**
4
3
  * @param {string|undefined} key
@@ -19,15 +18,15 @@ declare function linter(
19
18
  };
20
19
  declare namespace linter {
21
20
  export {
21
+ Compiler,
22
+ Compilation,
22
23
  Stylelint,
23
24
  LintResult,
24
25
  LinterResult,
25
26
  Formatter,
26
27
  FormatterType,
27
- Compiler,
28
- Compilation,
29
- Options,
30
28
  isPathIgnored,
29
+ Options,
31
30
  GenerateReport,
32
31
  Report,
33
32
  Reporter,
@@ -37,74 +36,15 @@ declare namespace linter {
37
36
  }
38
37
  type Options = import('./options').Options;
39
38
  type Compilation = import('webpack').Compilation;
40
- 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
- rule: import('stylelint').Rule<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
- resolveConfig: (
63
- filePath: string,
64
- options?:
65
- | Pick<
66
- import('stylelint').LinterOptions,
67
- 'cwd' | 'config' | 'configFile' | 'configBasedir'
68
- >
69
- | undefined
70
- ) => Promise<import('stylelint').Config | undefined>;
71
- utils: {
72
- report: (problem: import('stylelint').Problem) => void;
73
- ruleMessages: <
74
- T extends import('stylelint').RuleMessages,
75
- R extends { [K in keyof T]: T[K] }
76
- >(
77
- ruleName: string,
78
- messages: T
79
- ) => R;
80
- validateOptions: (
81
- result: import('stylelint').PostcssResult,
82
- ruleName: string,
83
- ...optionDescriptions: import('stylelint').RuleOptions[]
84
- ) => boolean;
85
- checkAgainstRule: <T_1, O extends Object>(
86
- options: {
87
- ruleName: string;
88
- ruleSettings: import('stylelint').ConfigRuleSettings<T_1, O>;
89
- root: import('postcss').Root;
90
- result?: import('stylelint').PostcssResult | undefined;
91
- context?: import('stylelint').RuleContext | undefined;
92
- },
93
- callback: (warning: import('postcss').Warning) => void
94
- ) => void;
95
- };
96
- reference: {
97
- longhandSubPropertiesOfShorthandProperties: import('stylelint').LonghandSubPropertiesOfShorthandProperties;
98
- };
99
- };
39
+ type Stylelint = import('./getStylelint').Stylelint;
100
40
  type Linter = (files: string | string[]) => void;
101
41
  type Reporter = () => Promise<Report>;
102
42
  import getStylelint = require('./getStylelint');
103
- type LintResult = import('stylelint').LintResult;
104
- type LinterResult = import('stylelint').LinterResult;
105
- type Formatter = import('stylelint').Formatter;
106
- type FormatterType = import('stylelint').FormatterType;
107
43
  type Compiler = import('webpack').Compiler;
44
+ type LintResult = import('./getStylelint').LintResult;
45
+ type LinterResult = import('./getStylelint').LinterResult;
46
+ type Formatter = import('./getStylelint').Formatter;
47
+ type FormatterType = import('./getStylelint').FormatterType;
108
48
  type isPathIgnored = import('./getStylelint').isPathIgnored;
109
49
  type GenerateReport = (compilation: Compilation) => Promise<void>;
110
50
  type Report = {
@@ -1,66 +1,5 @@
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
- rule: import('stylelint').Rule<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
- result?: import('stylelint').PostcssResult | undefined;
53
- context?: import('stylelint').RuleContext | undefined;
54
- },
55
- callback: (warning: import('postcss').Warning) => void
56
- ) => void;
57
- };
58
- reference: {
59
- longhandSubPropertiesOfShorthandProperties: import('stylelint').LonghandSubPropertiesOfShorthandProperties;
60
- };
61
- };
62
- export type StylelintOptions = import('stylelint').LinterOptions;
63
- export type FormatterType = import('stylelint').FormatterType;
1
+ export type StylelintOptions = import('./getStylelint').LinterOptions;
2
+ export type FormatterType = import('./getStylelint').FormatterType;
64
3
  export type OutputReport = {
65
4
  filePath?: string | undefined;
66
5
  formatter?: FormatterType | undefined;
@@ -82,9 +21,8 @@ export type PluginOptions = {
82
21
  threads?: (number | boolean) | undefined;
83
22
  };
84
23
  export type Options = Partial<PluginOptions & StylelintOptions>;
85
- /** @typedef {import("stylelint")} stylelint */
86
- /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
87
- /** @typedef {import("stylelint").FormatterType} FormatterType */
24
+ /** @typedef {import('./getStylelint').LinterOptions} StylelintOptions */
25
+ /** @typedef {import('./getStylelint').FormatterType} FormatterType */
88
26
  /**
89
27
  * @typedef {Object} OutputReport
90
28
  * @property {string=} filePath
package/types/worker.d.ts CHANGED
@@ -1,63 +1,3 @@
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
- rule: import('stylelint').Rule<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
- result?: import('stylelint').PostcssResult | undefined;
53
- context?: import('stylelint').RuleContext | undefined;
54
- },
55
- callback: (warning: import('postcss').Warning) => void
56
- ) => void;
57
- };
58
- reference: {
59
- longhandSubPropertiesOfShorthandProperties: import('stylelint').LonghandSubPropertiesOfShorthandProperties;
60
- };
61
- };
62
- export type StylelintOptions = import('stylelint').LinterOptions;
1
+ export type Stylelint = import('./getStylelint').Stylelint;
2
+ export type StylelintOptions = import('./getStylelint').LinterOptions;
63
3
  export type Options = import('./options').Options;