stylelint-webpack-plugin 1.0.1 → 1.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/CHANGELOG.md +28 -0
- package/README.md +10 -37
- package/dist/LintDirtyModulesPlugin.js +1 -1
- package/dist/index.js +5 -4
- package/dist/linter.js +1 -1
- package/dist/options.json +10 -18
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
+
## [1.1.0](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.4...v1.1.0) (2019-11-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
|
|
12
|
+
### [1.0.4](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.3...v1.0.4) (2019-11-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* hooks ([#195](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/195)) ([792fe19](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/792fe19))
|
|
18
|
+
|
|
19
|
+
### [1.0.3](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.2...v1.0.3) (2019-10-25)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* options variable ([#193](https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/193)) ([3389aec](https://github.com/webpack-contrib/stylelint-webpack-plugin/commit/3389aec))
|
|
25
|
+
|
|
26
|
+
### [1.0.2](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.1...v1.0.2) (2019-10-07)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* 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))
|
|
32
|
+
|
|
5
33
|
### [1.0.1](https://github.com/webpack-contrib/stylelint-webpack-plugin/compare/v1.0.0...v1.0.1) (2019-09-30)
|
|
6
34
|
|
|
7
35
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
npm install stylelint-webpack-plugin --save-dev
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**Note**: You also need to install `stylelint` from npm, if you haven't already:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
npm install stylelint --save-dev
|
|
@@ -29,7 +29,7 @@ npm install stylelint --save-dev
|
|
|
29
29
|
|
|
30
30
|
## Usage
|
|
31
31
|
|
|
32
|
-
In your webpack configuration
|
|
32
|
+
In your webpack configuration:
|
|
33
33
|
|
|
34
34
|
```js
|
|
35
35
|
const StylelintPlugin = require('stylelint-webpack-plugin');
|
|
@@ -43,25 +43,14 @@ module.exports = {
|
|
|
43
43
|
|
|
44
44
|
## Options
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
the complete list of options available. These options are passed through to the
|
|
48
|
-
`stylelint` directly.
|
|
49
|
-
|
|
50
|
-
### `configFile`
|
|
51
|
-
|
|
52
|
-
- Type: `String`
|
|
53
|
-
- Default: `undefined`
|
|
54
|
-
|
|
55
|
-
Specify the config file location to be used by `stylelint`.
|
|
56
|
-
|
|
57
|
-
_Note: By default this is [handled by `stylelint`](http://stylelint.io/user-guide/configuration/)._
|
|
46
|
+
You can pass [stylelint options](http://stylelint.io/user-guide/node-api/#options).
|
|
58
47
|
|
|
59
48
|
### `context`
|
|
60
49
|
|
|
61
50
|
- Type: `String`
|
|
62
51
|
- Default: `compiler.context`
|
|
63
52
|
|
|
64
|
-
A
|
|
53
|
+
A string indicating the root of your files.
|
|
65
54
|
|
|
66
55
|
### `files`
|
|
67
56
|
|
|
@@ -75,7 +64,7 @@ Specify the glob pattern for finding files. Must be relative to `options.context
|
|
|
75
64
|
- Type: `Function`
|
|
76
65
|
- Default: `require('stylelint').formatters.string`
|
|
77
66
|
|
|
78
|
-
Specify
|
|
67
|
+
Specify the formatter that you would like to use to format your results.
|
|
79
68
|
|
|
80
69
|
### `lintDirtyModulesOnly`
|
|
81
70
|
|
|
@@ -91,14 +80,6 @@ Lint only changed files, skip lint on start.
|
|
|
91
80
|
|
|
92
81
|
Path to `stylelint` instance that will be used for linting.
|
|
93
82
|
|
|
94
|
-
### `syntax`
|
|
95
|
-
|
|
96
|
-
- Type: `String`
|
|
97
|
-
- Default: `undefined`
|
|
98
|
-
|
|
99
|
-
See the `styelint` [user guide](https://stylelint.io/user-guide/node-api/#syntax) for more info.
|
|
100
|
-
e.g. use `'scss'` to lint .scss files.
|
|
101
|
-
|
|
102
83
|
### Errors and Warning
|
|
103
84
|
|
|
104
85
|
**By default the plugin will auto adjust error reporting depending on stylelint errors/warnings counts.**
|
|
@@ -109,43 +90,35 @@ You can still force this behavior by using `emitError` **or** `emitWarning` opti
|
|
|
109
90
|
- Type: `Boolean`
|
|
110
91
|
- Default: `false`
|
|
111
92
|
|
|
112
|
-
Will always return errors, if
|
|
93
|
+
Will always return errors, if set to `true`.
|
|
113
94
|
|
|
114
95
|
#### `emitWarning`
|
|
115
96
|
|
|
116
97
|
- Type: `Boolean`
|
|
117
98
|
- Default: `false`
|
|
118
99
|
|
|
119
|
-
Will always return warnings, if
|
|
100
|
+
Will always return warnings, if set to `true`.
|
|
120
101
|
|
|
121
102
|
#### `failOnError`
|
|
122
103
|
|
|
123
104
|
- Type: `Boolean`
|
|
124
105
|
- Default: `false`
|
|
125
106
|
|
|
126
|
-
Will cause the module build to fail if there are any errors, if
|
|
107
|
+
Will cause the module build to fail if there are any errors, if set to `true`.
|
|
127
108
|
|
|
128
109
|
#### `failOnWarning`
|
|
129
110
|
|
|
130
111
|
- Type: `Boolean`
|
|
131
112
|
- Default: `false`
|
|
132
113
|
|
|
133
|
-
Will cause the module build to fail if there are any warnings, if
|
|
114
|
+
Will cause the module build to fail if there are any warnings, if set to `true`.
|
|
134
115
|
|
|
135
116
|
#### `quiet`
|
|
136
117
|
|
|
137
118
|
- Type: `Boolean`
|
|
138
119
|
- Default: `false`
|
|
139
120
|
|
|
140
|
-
Will process and report errors only and ignore warnings, if
|
|
141
|
-
|
|
142
|
-
## Acknowledgement
|
|
143
|
-
|
|
144
|
-
This project was inspired by, and is a heavily modified version of
|
|
145
|
-
`sasslint-webpack-plugin`.
|
|
146
|
-
|
|
147
|
-
Thanks to Javier ([@vieron](https://github.com/vieron)) for authoring this
|
|
148
|
-
plugin.
|
|
121
|
+
Will process and report errors only and ignore warnings, if set to `true`.
|
|
149
122
|
|
|
150
123
|
## Changelog
|
|
151
124
|
|
|
@@ -30,7 +30,7 @@ class LintDirtyModulesPlugin {
|
|
|
30
30
|
|
|
31
31
|
const dirtyOptions = { ...this.options
|
|
32
32
|
};
|
|
33
|
-
const glob = dirtyOptions.files.join('|');
|
|
33
|
+
const glob = dirtyOptions.files.join('|').replace(/\\/g, '/');
|
|
34
34
|
const changedFiles = this.getChangedFiles(compilation.fileTimestamps, glob);
|
|
35
35
|
this.prevTimestamps = compilation.fileTimestamps;
|
|
36
36
|
|
package/dist/index.js
CHANGED
|
@@ -24,9 +24,8 @@ class StylelintWebpackPlugin {
|
|
|
24
24
|
|
|
25
25
|
apply(compiler) {
|
|
26
26
|
const context = this.getContext(compiler);
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
} = this;
|
|
27
|
+
const options = { ...this.options
|
|
28
|
+
};
|
|
30
29
|
options.files = (0, _arrify.default)(options.files).map(file => (0, _path.join)(context, '/', file));
|
|
31
30
|
const plugin = {
|
|
32
31
|
name: this.constructor.name
|
|
@@ -34,7 +33,9 @@ class StylelintWebpackPlugin {
|
|
|
34
33
|
|
|
35
34
|
if (options.lintDirtyModulesOnly) {
|
|
36
35
|
const lintDirty = new _LintDirtyModulesPlugin.default(compiler, options);
|
|
37
|
-
|
|
36
|
+
/* istanbul ignore next */
|
|
37
|
+
|
|
38
|
+
compiler.hooks.watchRun.tapAsync(plugin, (compilation, callback) => {
|
|
38
39
|
lintDirty.apply(compilation, callback);
|
|
39
40
|
});
|
|
40
41
|
} else {
|
package/dist/linter.js
CHANGED
|
@@ -33,7 +33,7 @@ function linter(options, compiler, callback) {
|
|
|
33
33
|
callback();
|
|
34
34
|
}
|
|
35
35
|
}).catch(callback);
|
|
36
|
-
compiler.hooks.
|
|
36
|
+
compiler.hooks.afterCompile.tapAsync('StylelintWebpackPlugin', (compilation, next) => {
|
|
37
37
|
if (warnings.length) {
|
|
38
38
|
compilation.warnings.push(_StylelintError.default.format(options, warnings));
|
|
39
39
|
warnings = [];
|
package/dist/options.json
CHANGED
|
@@ -2,28 +2,24 @@
|
|
|
2
2
|
"type": "object",
|
|
3
3
|
"additionalProperties": true,
|
|
4
4
|
"properties": {
|
|
5
|
-
"configFile": {
|
|
6
|
-
"description": "Specify the config file location to be used by `stylelint`.",
|
|
7
|
-
"type": "string"
|
|
8
|
-
},
|
|
9
5
|
"context": {
|
|
10
|
-
"description": "A
|
|
6
|
+
"description": "A string indicating the root of your files.",
|
|
11
7
|
"type": "string"
|
|
12
8
|
},
|
|
13
9
|
"emitError": {
|
|
14
|
-
"description": "Will always return errors, if
|
|
10
|
+
"description": "Will always return errors, if set to `true`.",
|
|
15
11
|
"type": "boolean"
|
|
16
12
|
},
|
|
17
13
|
"emitWarning": {
|
|
18
|
-
"description": "Will always return warnings, if
|
|
14
|
+
"description": "Will always return warnings, if set to `true`.",
|
|
19
15
|
"type": "boolean"
|
|
20
16
|
},
|
|
21
17
|
"failOnError": {
|
|
22
|
-
"description": "Will cause the module build to fail if there are any errors, if
|
|
18
|
+
"description": "Will cause the module build to fail if there are any errors, if set to `true`.",
|
|
23
19
|
"type": "boolean"
|
|
24
20
|
},
|
|
25
21
|
"failOnWarning": {
|
|
26
|
-
"description": "Will cause the module build to fail if there are any warnings, if
|
|
22
|
+
"description": "Will cause the module build to fail if there are any warnings, if set to `true`.",
|
|
27
23
|
"type": "boolean"
|
|
28
24
|
},
|
|
29
25
|
"files": {
|
|
@@ -31,24 +27,20 @@
|
|
|
31
27
|
"anyOf": [{ "type": "string" }, { "type": "array" }]
|
|
32
28
|
},
|
|
33
29
|
"formatter": {
|
|
34
|
-
"description": "Specify
|
|
30
|
+
"description": "Specify the formatter that you would like to use to format your results.",
|
|
35
31
|
"instanceof": "Function"
|
|
36
32
|
},
|
|
37
33
|
"lintDirtyModulesOnly": {
|
|
38
34
|
"description": "Lint only changed files, skip lint on start.",
|
|
39
35
|
"type": "boolean"
|
|
40
36
|
},
|
|
37
|
+
"quiet": {
|
|
38
|
+
"description": "Will process and report errors only and ignore warnings, if set to `true`.",
|
|
39
|
+
"type": "boolean"
|
|
40
|
+
},
|
|
41
41
|
"stylelintPath": {
|
|
42
42
|
"description": "Path to `stylelint` instance that will be used for linting.",
|
|
43
43
|
"type": "string"
|
|
44
|
-
},
|
|
45
|
-
"syntax": {
|
|
46
|
-
"description": "See the `styelint` [user guide](https://stylelint.io/user-guide/node-api/#syntax) for more info. e.g. use `'scss'` to lint .scss files.",
|
|
47
|
-
"type": "string"
|
|
48
|
-
},
|
|
49
|
-
"quiet": {
|
|
50
|
-
"description": "Will process and report errors only and ignore warnings, if this option is set to `true`.",
|
|
51
|
-
"type": "boolean"
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stylelint-webpack-plugin",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A stylelint plugin for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/stylelint-webpack-plugin",
|
|
@@ -34,43 +34,43 @@
|
|
|
34
34
|
"dist"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"stylelint": "^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
37
|
+
"stylelint": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
38
38
|
"webpack": "^4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"arrify": "^2.0.1",
|
|
42
42
|
"micromatch": "^4.0.2",
|
|
43
|
-
"schema-utils": "^2.
|
|
43
|
+
"schema-utils": "^2.5.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@babel/cli": "^7.
|
|
47
|
-
"@babel/core": "^7.
|
|
48
|
-
"@babel/preset-env": "^7.
|
|
46
|
+
"@babel/cli": "^7.7.0",
|
|
47
|
+
"@babel/core": "^7.7.2",
|
|
48
|
+
"@babel/preset-env": "^7.7.1",
|
|
49
49
|
"@commitlint/cli": "^8.2.0",
|
|
50
50
|
"@commitlint/config-conventional": "^8.2.0",
|
|
51
|
-
"@webpack-contrib/defaults": "^5.
|
|
51
|
+
"@webpack-contrib/defaults": "^5.1.1",
|
|
52
52
|
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
|
|
53
53
|
"babel-eslint": "^10.0.3",
|
|
54
54
|
"babel-jest": "^24.9.0",
|
|
55
55
|
"commitlint-azure-pipelines-cli": "^1.0.2",
|
|
56
|
-
"cross-env": "^6.0.
|
|
56
|
+
"cross-env": "^6.0.3",
|
|
57
57
|
"del": "^5.1.0",
|
|
58
58
|
"del-cli": "^3.0.0",
|
|
59
|
-
"eslint": "^6.
|
|
60
|
-
"eslint-config-prettier": "^6.
|
|
59
|
+
"eslint": "^6.6.0",
|
|
60
|
+
"eslint-config-prettier": "^6.5.0",
|
|
61
61
|
"eslint-friendly-formatter": "^4.0.1",
|
|
62
62
|
"eslint-plugin-import": "^2.18.2",
|
|
63
63
|
"file-loader": "^4.2.0",
|
|
64
|
-
"husky": "^3.0.
|
|
64
|
+
"husky": "^3.0.9",
|
|
65
65
|
"jest": "^24.9.0",
|
|
66
|
-
"jest-junit": "^
|
|
67
|
-
"lint-staged": "^9.
|
|
66
|
+
"jest-junit": "^9.0.0",
|
|
67
|
+
"lint-staged": "^9.4.2",
|
|
68
68
|
"mkdirp": "^0.5.1",
|
|
69
69
|
"npm-run-all": "^4.1.5",
|
|
70
|
-
"prettier": "^1.
|
|
70
|
+
"prettier": "^1.19.1",
|
|
71
71
|
"standard-version": "^7.0.0",
|
|
72
|
-
"stylelint": "^11.
|
|
73
|
-
"webpack": "^4.41.
|
|
72
|
+
"stylelint": "^11.1.1",
|
|
73
|
+
"webpack": "^4.41.2"
|
|
74
74
|
},
|
|
75
75
|
"keywords": [
|
|
76
76
|
"stylelint",
|