reportNeedlessDisables doesn't work
danielzgtg opened this issue · 2 comments
danielzgtg commented
- Operating System: Linux
- Node Version: v14.4.0
- NPM Version: 6.14.5
- webpack Version: 4.43.0
- stylelint-webpack-plugin Version: 2.0.1
Expected Behavior
reportNeedlessDisables
does something:
- At least it should cause the console output to change
- Preferably, using it with
failOnWarning
stops the build - Preferably, have
reportInvalidScopeDisables
working as well - Alternatively, and less preferably, for
reportNeedlessDisables
not to show up in the Typescript declarations
Actual Behavior
reportNeedlessDisables
does nothing.
This is a problem because the underlying stylelint supports this perfectly fine, and reportNeedlessDisables
being present in the types confusingly suggests that it is supported in stylelint-webpack-plugin .
Code
// webpack.config.js
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './src/index.js',
output: {filename: 'main.js', path: (path = require('path')).resolve(__dirname, 'dist')},
plugins: [
new (require('html-webpack-plugin'))({}), new MiniCssExtractPlugin({}),
new (require('stylelint-webpack-plugin'))({
context: 'src', files: '**/*.css',
emitError: true, emitWarning: true, failOnError: true, failOnWarning: true,
reportNeedlessDisables: true, reportInvalidScopeDisables: true,
}),
],
module: {rules: [{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader,'css-loader'],
}]},
mode: 'development',
};
// .stylelintrc.json
{
"rules": {
"indentation": [2]
}
}
// src/index.js
import './index.css';
/* src/index.css */
p {
/* stylelint-disable-next-line indentation */
color: red;
}
// package.json
{
"name": "test123",
"version": "1.0.0",
"scripts": {
"build": "webpack"
},
"dependencies": {
"css-loader": "^3.6.0",
"html-webpack-plugin": "^4.3.0",
"mini-css-extract-plugin": "^0.9.0",
"stylelint": "^13.6.1",
"stylelint-webpack-plugin": "^2.0.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
}
}
How Do We Reproduce?
All the files are above and each is less than 50 lines long.
ricardogobbosouza commented
Hi @danielzgtg
It is a CLI option https://stylelint.io/user-guide/usage/cli#command-line-interface-cli
We need to have the option of handling it on return https://stylelint.io/user-guide/usage/node-api#needlessdisables
ricardogobbosouza commented
@danielzgtg fixed on v2.2.2