-
Notifications
You must be signed in to change notification settings - Fork 76
Stylelint support #38
Comments
Hello! We currently support 3 types of errors:
The other errors are given 0 priority and all the errors with the same priority should be displayed at the same time. |
Stylelint could be a fine addition! You could also contribute a test! |
I use this stub for development to show stylelint errors: webpack.transformer.js const _ = require("lodash");
function isWebpackError (e) {
return _.isEmpty(e.originalStack) && _.isNil(e.file) && _.has(e, "webpackError");
}
function transform(error) {
if (isWebpackError(error)) {
return Object.assign({}, error, {
name: "Webpack error",
type: "webpack-error"
});
}
return error;
}
module.exports = transform; webpack.formatter.js function concat(...args) {
args = Array.from(args).filter(e => e !== null);
const baseArray = Array.isArray(args[0]) ? args[0] : [args[0]];
return Array.prototype.concat.apply(baseArray, args.slice(1));
}
function displayError(error) {
return [error.webpackError, ""];
}
function format(errors) {
const lintErrors = errors.filter(e => e.type === "webpack-error");
if (lintErrors.length > 0) {
const flatten = (accum, curr) => accum.concat(curr);
return concat(
lintErrors
.map(error => displayError(error))
.reduce(flatten, [])
);
}
return [];
}
module.exports = format; webpack.config.js // ...
const webpackErrorTransformer = require("./transformers/webpack.transformer");
const webpackErrorFormatter = require("./formatters/webpack.formatter");
// ...
plugins: [
new FriendlyErrorsWebpackPlugin({
additionalTransformers: [webpackErrorTransformer],
additionalFormatters: [webpackErrorFormatter]
}),
// ... I didn't find any reasons to dedicate this solution to stylelint, beacause this way any other webpack error could be shown. Basically, there's no stack at all and |
For more info: geowarin/friendly-errors-webpack-plugin#38 (cherry picked from commit aff85f6)
+1 to @iceekey solution, this fixes my issue where stylelint plugin is not showing error logs for webpack dev server. |
@iceekey Nice thank you! Could you make a pull request including your changes? |
@geowarin Thank you. I'll make a pull request in a spare time. |
So does it support stylelint error now? |
Hey, i am having a problem displaying the Stylelint errors, i am not sure if its setup issue i created.
![bildschirmfoto 2017-03-01 um 22 39 54](https://cloud.githubusercontent.com/assets/18122799/23482774/954df678-fed0-11e6-91eb-eb5a208a8643.png)
If i use the
friendly-errors-webpack-plugin
enabled it wont show the stylelint errors, only the native ones :if i disable the plugin it will display both:
![bildschirmfoto 2017-03-01 um 22 43 59](https://cloud.githubusercontent.com/assets/18122799/23482790/a03f24b2-fed0-11e6-8def-0e2631873bcb.png)
how do i disable the other reporter or give stylelint the priority ? i know it might be not the right place to ask but i figured some of u might have run into the same issue.
thats my webpack.config.js:
thats my postcss.config.js:
The text was updated successfully, but these errors were encountered: