I want to add Stylelint to my Next.js app. I am asking if I can edit next.config.js
to add stylelint-webpack-plugin, so I get styles errors during compilation.
// next.config.js
module.exports = {
reactStrictMode: true,
};
npm i stylelint stylelint-webpack-plugin --save-dev
.stylelintignore
file in your root folder et past in it:node_modules
next.config.js
file:const StylelintPlugin = require("stylelint-webpack-plugin"); // line to add
module.exports = {
reactStrictMode: true,
// lines to add
webpack: (config, options) => {
config.plugins.push(new StylelintPlugin());
return config;
},
};
npm i stylelint-config-standard --save-dev
.stylelintrc
file in your root folder and past in it:{
"extends": "stylelint-config-standard",
"rules": {
"string-quotes": "double"
}
}
npm i sass stylelint-config-standard-scss --save-dev
.stylelintrc
file in your root folder and past in it:{
"extends": "stylelint-config-standard-scss",
"rules": {
"string-quotes": "double"
}
}