stylelint-webpack-plugin 2.1.0 → 2.2.2

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.
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getOptions = getOptions;
7
+ exports.getStylelintOptions = getStylelintOptions;
8
+
9
+ var _schemaUtils = require("schema-utils");
10
+
11
+ var _options = _interopRequireDefault(require("./options.json"));
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ // @ts-ignore
16
+
17
+ /** @typedef {import("stylelint")} stylelint */
18
+
19
+ /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
20
+
21
+ /** @typedef {import("stylelint").FormatterType} FormatterType */
22
+
23
+ /**
24
+ * @typedef {Object} OutputReport
25
+ * @property {string=} filePath
26
+ * @property {FormatterType=} formatter
27
+ */
28
+
29
+ /**
30
+ * @typedef {Object} PluginOptions
31
+ * @property {string} context
32
+ * @property {boolean} emitError
33
+ * @property {boolean} emitWarning
34
+ * @property {string|string[]=} exclude
35
+ * @property {string|string[]} extensions
36
+ * @property {boolean} failOnError
37
+ * @property {boolean} failOnWarning
38
+ * @property {string|string[]} files
39
+ * @property {FormatterType} formatter
40
+ * @property {boolean} lintDirtyModulesOnly
41
+ * @property {boolean} quiet
42
+ * @property {string} stylelintPath
43
+ * @property {OutputReport} outputReport
44
+ * @property {number|boolean=} threads
45
+ */
46
+
47
+ /** @typedef {Partial<PluginOptions & StylelintOptions>} Options */
48
+
49
+ /**
50
+ * @param {Options} pluginOptions
51
+ * @returns {Partial<PluginOptions>}
52
+ */
53
+ function getOptions(pluginOptions) {
54
+ const options = {
55
+ extensions: ['css', 'scss', 'sass'],
56
+ emitError: true,
57
+ emitWarning: true,
58
+ failOnError: true,
59
+ ...pluginOptions,
60
+ ...(pluginOptions.quiet ? {
61
+ emitError: true,
62
+ emitWarning: false
63
+ } : {})
64
+ }; // @ts-ignore
65
+
66
+ (0, _schemaUtils.validate)(_options.default, options, {
67
+ name: 'Stylelint Webpack Plugin',
68
+ baseDataPath: 'options'
69
+ });
70
+ return options;
71
+ }
72
+ /**
73
+ * @param {Options} pluginOptions
74
+ * @returns {Partial<StylelintOptions>}
75
+ */
76
+
77
+
78
+ function getStylelintOptions(pluginOptions) {
79
+ const stylelintOptions = { ...pluginOptions
80
+ }; // Keep the files and formatter option because it is common to both the plugin and Stylelint.
81
+
82
+ const {
83
+ files,
84
+ formatter,
85
+ ...stylelintOnlyOptions
86
+ } = _options.default.properties; // No need to guard the for-in because schema.properties has hardcoded keys.
87
+ // eslint-disable-next-line guard-for-in
88
+
89
+ for (const option in stylelintOnlyOptions) {
90
+ // @ts-ignore
91
+ delete stylelintOptions[option];
92
+ }
93
+
94
+ return stylelintOptions;
95
+ }
package/dist/options.json CHANGED
@@ -7,15 +7,23 @@
7
7
  "type": "string"
8
8
  },
9
9
  "emitError": {
10
- "description": "Will always return errors, if set to `true`.",
10
+ "description": "The errors found will always be emitted, to disable set to `false`.",
11
11
  "type": "boolean"
12
12
  },
13
13
  "emitWarning": {
14
- "description": "Will always return warnings, if set to `true`.",
14
+ "description": "The warnings found will always be emitted, to disable set to `false`.",
15
15
  "type": "boolean"
16
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
+ },
17
25
  "failOnError": {
18
- "description": "Will cause the module build to fail if there are any errors, if set to `true`.",
26
+ "description": "Will cause the module build to fail if there are any errors, to disable set to `false`.",
19
27
  "type": "boolean"
20
28
  },
21
29
  "failOnWarning": {
@@ -23,7 +31,7 @@
23
31
  "type": "boolean"
24
32
  },
25
33
  "files": {
26
- "description": "Specify the glob pattern for finding files. Must be relative to `options.context`.",
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`.",
27
35
  "anyOf": [{ "type": "string" }, { "type": "array" }]
28
36
  },
29
37
  "formatter": {
@@ -41,6 +49,32 @@
41
49
  "stylelintPath": {
42
50
  "description": "Path to `stylelint` instance that will be used for linting.",
43
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" }]
44
78
  }
45
79
  }
46
80
  }
package/dist/utils.js CHANGED
@@ -4,28 +4,83 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.parseFiles = parseFiles;
7
- exports.replaceBackslashes = replaceBackslashes;
7
+ exports.parseFoldersToGlobs = parseFoldersToGlobs;
8
+ exports.jsonStringifyReplacerSortKeys = void 0;
9
+
10
+ var _path = require("path");
11
+
12
+ var _fs = require("fs");
13
+
14
+ var _normalizePath = _interopRequireDefault(require("normalize-path"));
8
15
 
9
16
  var _arrify = _interopRequireDefault(require("arrify"));
10
17
 
11
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
19
 
13
- const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
20
+ // @ts-ignore
21
+ // @ts-ignore
22
+
14
23
  /**
15
- * @param {Array<string> | string} files
24
+ * @param {string|(string|undefined)[]} files
16
25
  * @param {string} context
17
- * @returns {Array<string>}
26
+ * @returns {string[]}
18
27
  */
19
-
20
28
  function parseFiles(files, context) {
21
- return (0, _arrify.default)(files).map(file => `${replaceBackslashes(context).replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2')}/${replaceBackslashes(file)}`);
29
+ return (0, _arrify.default)(files).filter((
30
+ /** @type {string} */
31
+ file) => typeof file === 'string').map((
32
+ /** @type {string} */
33
+ file) => (0, _normalizePath.default)((0, _path.resolve)(context, file)));
34
+ }
35
+ /**
36
+ * @param {string|string[]} patterns
37
+ * @param {string|string[]} extensions
38
+ * @returns {string[]}
39
+ */
40
+
41
+
42
+ function parseFoldersToGlobs(patterns, extensions = []) {
43
+ const extensionsList = (0, _arrify.default)(extensions);
44
+ 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) => {
51
+ try {
52
+ // The patterns are absolute because they are prepended with the context.
53
+ const stats = (0, _fs.statSync)(pattern);
54
+ /* istanbul ignore else */
55
+
56
+ if (stats.isDirectory()) {
57
+ return pattern.replace(/[/\\]*?$/u, `/**${extensionsGlob ? `/*.${prefix + extensionsGlob + postfix}` : ''}`);
58
+ }
59
+ } catch (_) {// Return the pattern as is on error.
60
+ }
61
+
62
+ return pattern;
63
+ });
22
64
  }
23
65
  /**
24
- * @param {string} str
25
- * @returns {string}
66
+ *
67
+ * @param {string} _ key, but unused
68
+ * @param {any} value
26
69
  */
27
70
 
28
71
 
29
- function replaceBackslashes(str) {
30
- return str.replace(/\\/g, '/');
31
- }
72
+ const jsonStringifyReplacerSortKeys = (_, value) => {
73
+ /**
74
+ * @param {{ [x: string]: any; }} sorted
75
+ * @param {string | number} key
76
+ */
77
+ const insert = (sorted, key) => {
78
+ // eslint-disable-next-line no-param-reassign
79
+ sorted[key] = value[key];
80
+ return sorted;
81
+ };
82
+
83
+ return value instanceof Object && !(value instanceof Array) ? Object.keys(value).sort().reduce(insert, {}) : value;
84
+ };
85
+
86
+ exports.jsonStringifyReplacerSortKeys = jsonStringifyReplacerSortKeys;
package/dist/worker.js ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ /** @typedef {import('stylelint')} Stylelint */
4
+
5
+ /** @typedef {import("stylelint").LinterOptions} StylelintOptions */
6
+
7
+ /** @typedef {import('./options').Options} Options */
8
+ Object.assign(module.exports, {
9
+ lintFiles,
10
+ setup
11
+ });
12
+ /** @type {Stylelint} */
13
+
14
+ let stylelint;
15
+ /** @type {Partial<StylelintOptions>} */
16
+
17
+ let linterOptions;
18
+ /**
19
+ * @param {Options} options
20
+ * @param {Partial<StylelintOptions>} stylelintOptions
21
+ */
22
+
23
+ function setup(options, stylelintOptions) {
24
+ stylelint = require(options.stylelintPath || 'stylelint');
25
+ linterOptions = stylelintOptions;
26
+ return stylelint;
27
+ }
28
+ /**
29
+ * @param {string | string[]} files
30
+ */
31
+
32
+
33
+ async function lintFiles(files) {
34
+ const {
35
+ results
36
+ } = await stylelint.lint({ ...linterOptions,
37
+ files
38
+ }); // Reset result to work with worker
39
+
40
+ return results.map(result => {
41
+ return {
42
+ source: result.source,
43
+ errored: result.errored,
44
+ ignored: result.ignored,
45
+ warnings: result.warnings,
46
+ deprecations: result.deprecations,
47
+ invalidOptionWarnings: result.invalidOptionWarnings
48
+ };
49
+ });
50
+ }
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "stylelint-webpack-plugin",
3
- "version": "2.1.0",
3
+ "version": "2.2.2",
4
4
  "description": "A Stylelint plugin for webpack",
5
5
  "license": "MIT",
6
6
  "repository": "webpack-contrib/stylelint-webpack-plugin",
7
- "author": "Javier Sánchez-Marín <javiersanchezmarin@gmail.com>",
8
- "contributors": [
9
- "Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>"
10
- ],
7
+ "author": "Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>",
11
8
  "homepage": "https://github.com/webpack-contrib/stylelint-webpack-plugin",
12
9
  "bugs": "https://github.com/webpack-contrib/stylelint-webpack-plugin/issues",
13
10
  "funding": {
@@ -28,18 +25,17 @@
28
25
  "build": "npm-run-all -p \"build:**\"",
29
26
  "commitlint": "commitlint --from=master",
30
27
  "security": "npm audit",
31
- "lint:prettier": "prettier --list-different .",
28
+ "lint:prettier": "prettier -w --list-different .",
32
29
  "lint:js": "eslint --cache .",
33
30
  "lint:types": "tsc --pretty --noEmit",
34
31
  "lint": "npm-run-all -l -p \"lint:**\"",
35
- "test:only": "cross-env NODE_ENV=test jest",
32
+ "test:only": "cross-env NODE_ENV=test jest --testTimeout=60000",
36
33
  "test:watch": "npm run test:only -- --watch",
37
34
  "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
38
35
  "pretest": "npm run lint",
39
36
  "test": "npm run test:coverage",
40
- "prepare": "npm run build",
41
- "release": "standard-version",
42
- "defaults": "webpack-defaults"
37
+ "prepare": "husky install && npm run build",
38
+ "release": "standard-version"
43
39
  },
44
40
  "files": [
45
41
  "dist",
@@ -50,40 +46,45 @@
50
46
  "webpack": "^4.0.0 || ^5.0.0"
51
47
  },
52
48
  "dependencies": {
49
+ "@types/stylelint": "^13.13.0",
53
50
  "arrify": "^2.0.1",
54
- "micromatch": "^4.0.2",
55
- "schema-utils": "^2.7.0"
51
+ "jest-worker": "^27.0.2",
52
+ "globby": "^11.0.4",
53
+ "micromatch": "^4.0.4",
54
+ "normalize-path": "^3.0.0",
55
+ "schema-utils": "^3.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@babel/cli": "^7.10.1",
59
- "@babel/core": "^7.10.2",
60
- "@babel/preset-env": "^7.10.2",
61
- "@commitlint/cli": "^8.3.5",
62
- "@commitlint/config-conventional": "^8.3.4",
58
+ "@babel/cli": "^7.14.5",
59
+ "@babel/core": "^7.14.6",
60
+ "@babel/preset-env": "^7.14.5",
61
+ "@commitlint/cli": "^12.1.4",
62
+ "@commitlint/config-conventional": "^12.1.4",
63
+ "@types/fs-extra": "^9.0.11",
63
64
  "@types/micromatch": "^4.0.1",
64
- "@types/stylelint": "^9.10.1",
65
- "@types/webpack": "^4.41.17",
66
- "@webpack-contrib/defaults": "^6.3.0",
65
+ "@types/normalize-path": "^3.0.0",
66
+ "@types/webpack": "^5.28.0",
67
67
  "@webpack-contrib/eslint-config-webpack": "^3.0.0",
68
68
  "babel-eslint": "^10.1.0",
69
- "babel-jest": "^26.0.1",
70
- "cross-env": "^7.0.2",
71
- "del": "^5.1.0",
69
+ "babel-jest": "^27.0.2",
70
+ "chokidar": "^3.5.2",
71
+ "cross-env": "^7.0.3",
72
+ "del": "^6.0.0",
72
73
  "del-cli": "^3.0.1",
73
- "eslint": "^7.2.0",
74
- "eslint-config-prettier": "^6.11.0",
75
- "eslint-friendly-formatter": "^4.0.1",
76
- "eslint-plugin-import": "^2.21.2",
77
- "file-loader": "^6.0.0",
78
- "husky": "^4.2.5",
79
- "jest": "^26.0.1",
80
- "lint-staged": "^10.2.10",
74
+ "eslint": "^7.28.0",
75
+ "eslint-config-prettier": "^8.3.0",
76
+ "eslint-plugin-import": "^2.23.4",
77
+ "file-loader": "^6.2.0",
78
+ "fs-extra": "^9.1.0",
79
+ "husky": "^6.0.0",
80
+ "jest": "^27.0.4",
81
+ "lint-staged": "^10.5.4",
81
82
  "npm-run-all": "^4.1.5",
82
- "prettier": "^2.0.5",
83
- "standard-version": "^8.0.0",
84
- "stylelint": "^13.6.0",
85
- "typescript": "^3.9.5",
86
- "webpack": "^4.43.0"
83
+ "prettier": "^2.3.1",
84
+ "standard-version": "^9.3.0",
85
+ "stylelint": "^13.13.1",
86
+ "typescript": "^4.3.2",
87
+ "webpack": "^5.39.0"
87
88
  },
88
89
  "keywords": [
89
90
  "stylelint",
package/CHANGELOG.md DELETED
@@ -1,124 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
-
5
- ## [2.1.0](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.2.3...v2.1.0) (2020-06-17)
6
-
7
-
8
- ### Features
9
-
10
- * support typescript ([#213](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/213)) ([b7dfa19](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/b7dfa195b7836bad7ac94a64a0c0a6163021a3e7))
11
-
12
- ## [2.0.0](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.2.3...v2.0.0) (2020-05-04)
13
-
14
- ### ⚠ BREAKING CHANGES
15
-
16
- * minimum supported Node.js version is `10.13`
17
- * minimum supported stylelint version is `13.0.0`
18
-
19
- ### Bug Fixes
20
-
21
- * avoiding https://github.com/mrmlnc/fast-glob/issues/158 ([#209](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/209)) ([14ae30d](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/14ae30df8a6d6b629c4e1fa647b4c6989377aec8))
22
-
23
- ### [1.2.3](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.2.2...v1.2.3) (2020-02-08)
24
-
25
-
26
- ### Performance
27
-
28
- * require lint of stylelint only one time ([#207](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/207)) ([7e2495e](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/7e2495e6ba4d8cebb7f07cc9418020ea494670f8))
29
-
30
- ### [1.2.2](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.2.1...v1.2.2) (2020-02-08)
31
-
32
-
33
- ### Bug Fixes
34
-
35
- * replace back slashes on changed files ([#206](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/206)) ([7508028](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/7508028398d366c37d1a14e254baec9dc39b816c))
36
-
37
- ### [1.2.1](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.2.0...v1.2.1) (2020-01-16)
38
-
39
-
40
- ### Bug Fixes
41
-
42
- * compatibility stylelint v13 ([#204](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/204)) ([483be31](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/483be318450ec9a4f9eeb4bf1b1db203ba0c863d))
43
-
44
- ## [1.2.0](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.1.2...v1.2.0) (2020-01-13)
45
-
46
-
47
- ### Features
48
-
49
- * make possible to define official formatter as string ([#202](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/202)) ([8d6599c](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/8d6599c3f2f0e26d1515b01f6ecbafabeaa68fac))
50
- * support stylelint v13 ([#203](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/203)) ([6fb31a3](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/6fb31a3931cb9d7cb0ce8cc99c9db28f928c82f4))
51
-
52
- ### [1.1.2](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.1.1...v1.1.2) (2019-12-04)
53
-
54
-
55
- ### Bug Fixes
56
-
57
- * support webpack 5 ([#199](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/199)) ([3d9e544](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/3d9e544f31172b7c01f4bd7c7254cfc7e38466c9))
58
-
59
- ### [1.1.1](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.1.0...v1.1.1) (2019-12-01)
60
-
61
-
62
- ### Bug Fixes
63
-
64
- * use hook `afterEmit` and emit error on catch ([17f7421](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/17f7421030e6a5b589b2cab015d9af80b868ca95))
65
-
66
- ## [1.1.0](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.4...v1.1.0) (2019-11-18)
67
-
68
-
69
- ### Features
70
-
71
- * support stylelint v12 ([#196](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/196)) ([aacf7ad](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/aacf7ad))
72
-
73
- ### [1.0.4](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.3...v1.0.4) (2019-11-13)
74
-
75
-
76
- ### Bug Fixes
77
-
78
- * hooks ([#195](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/195)) ([792fe19](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/792fe19))
79
-
80
- ### [1.0.3](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.2...v1.0.3) (2019-10-25)
81
-
82
-
83
- ### Bug Fixes
84
-
85
- * options variable ([#193](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/193)) ([3389aec](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/3389aec))
86
-
87
- ### [1.0.2](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.1...v1.0.2) (2019-10-07)
88
-
89
-
90
- ### Bug Fixes
91
-
92
- * convert back-slashes ([#186](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/186)) ([41b0f53](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/41b0f53))
93
-
94
- ### [1.0.1](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.0...v1.0.1) (2019-09-30)
95
-
96
-
97
- ### Bug Fixes
98
-
99
- * compiler hooks ([aca2c1d](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/aca2c1d))
100
-
101
- ## 1.0.0 (2019-09-30)
102
-
103
- ### Bug Fixes
104
-
105
- * Handle compilation.fileTimestamps for webpack 4
106
- * DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
107
- * Update option `emitError`
108
- * Update option `failOnError`
109
-
110
- ### Features
111
-
112
- * Modernize project to latest defaults
113
- * Validate options
114
- * Support absolute paths in files array
115
- * New option `stylelintPath`
116
- * New option `emitWarning`
117
- * New option `failOnWarning`
118
- * New option `quiet`
119
-
120
- ### ⚠ BREAKING CHANGES
121
-
122
- * Drop support for Node < 8.9.0
123
- * Minimum supported `webpack` version is 4
124
- * Minimum supported `stylelint` version is 9
@@ -1,58 +0,0 @@
1
- /** @typedef {import('webpack').Compiler} Compiler */
2
- /** @typedef {import('./getOptions').Options} Options */
3
- /** @typedef {import('./linter').Lint} Lint */
4
- /** @typedef {import('./linter').LinterCallback} LinterCallback */
5
- /** @typedef {Partial<{timestamp:number} | number>} FileSystemInfoEntry */
6
- export default class LintDirtyModulesPlugin {
7
- /**
8
- * @param {Lint} lint
9
- * @param {Compiler} compiler
10
- * @param {Options} options
11
- */
12
- constructor(lint: Lint, compiler: Compiler, options: Options);
13
- lint: import('./linter').Lint;
14
- compiler: import('webpack').Compiler;
15
- options: import('./getOptions').Options;
16
- startTime: number;
17
- prevTimestamps: Map<any, any>;
18
- isFirstRun: boolean;
19
- /**
20
- * @param {Compiler} compilation
21
- * @param {LinterCallback} callback
22
- * @returns {void}
23
- */
24
- apply(compilation: Compiler, callback: LinterCallback): void;
25
- /**
26
- * @param {Map<string, number>} fileTimestamps
27
- * @param {string | ReadonlyArray<string>} glob
28
- * @returns {Array<string>}
29
- */
30
- getChangedFiles(
31
- fileTimestamps: Map<string, number>,
32
- glob: string | ReadonlyArray<string>
33
- ): Array<string>;
34
- }
35
- export type Compiler = import('webpack').Compiler;
36
- export type Options = {
37
- context?: string | undefined;
38
- emitError?: boolean | undefined;
39
- emitWarning?: boolean | undefined;
40
- failOnError?: boolean | undefined;
41
- failOnWarning?: boolean | undefined;
42
- files: string | string[];
43
- formatter: TimerHandler;
44
- lintDirtyModulesOnly?: boolean | undefined;
45
- quiet?: boolean | undefined;
46
- stylelintPath: string;
47
- };
48
- export type Lint = (
49
- options: import('./getOptions').Options
50
- ) => Promise<import('stylelint').LinterResult>;
51
- export type LinterCallback = (
52
- error?: import('./StylelintError').default | null | undefined
53
- ) => void;
54
- export type FileSystemInfoEntry =
55
- | number
56
- | Partial<{
57
- timestamp: number;
58
- }>;
@@ -1,32 +0,0 @@
1
- /** @typedef {import("stylelint")} stylelint */
2
- /**
3
- * @typedef {Object} Options
4
- * @property {string=} context
5
- * @property {boolean=} emitError
6
- * @property {boolean=} emitWarning
7
- * @property {boolean=} failOnError
8
- * @property {boolean=} failOnWarning
9
- * @property {Array<string> | string} files
10
- * @property {Function | string} formatter
11
- * @property {boolean=} lintDirtyModulesOnly
12
- * @property {boolean=} quiet
13
- * @property {string} stylelintPath
14
- */
15
- /**
16
- * @param {Partial<Options>} pluginOptions
17
- * @returns {Options}
18
- */
19
- export default function getOptions(pluginOptions: Partial<Options>): Options;
20
- export type stylelint = typeof import('stylelint');
21
- export type Options = {
22
- context?: string | undefined;
23
- emitError?: boolean | undefined;
24
- emitWarning?: boolean | undefined;
25
- failOnError?: boolean | undefined;
26
- failOnWarning?: boolean | undefined;
27
- files: Array<string> | string;
28
- formatter: Function | string;
29
- lintDirtyModulesOnly?: boolean | undefined;
30
- quiet?: boolean | undefined;
31
- stylelintPath: string;
32
- };