Created
November 2, 2015 20:45
-
-
Save vladkosinov/2d0497be4e9eece144d1 to your computer and use it in GitHub Desktop.
How to use stylelint with postcss loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
module: { | |
loaders: [ | |
{test: CSS_REGEX, loaders: ['style', 'css', 'postcss']}, | |
] | |
}, | |
postcss: () => [require('stylelint'), require('postcss-reporter')] | |
} |
The same. In my case it says:
ERROR in ./~/css-loader?importLoaders=1&modules!./~/postcss-loader!./src/scripts/pages/examples/Counter/components/Counter/style.css
Module build failed: Error: No rules found within configuration
at exports.default (/Users/vyorkin/github/starter-kit/node_modules/stylelint/dist/utils/configurationError.js:8:13)
at /Users/vyorkin/github/starter-kit/node_modules/stylelint/dist/postcssPlugin.js:52:43
at LazyResult.run (/Users/vyorkin/github/starter-kit/node_modules/postcss/lib/lazy-result.js:201:20)
at /Users/vyorkin/github/starter-kit/node_modules/postcss/lib/lazy-result.js:115:37
at LazyResult.asyncTick (/Users/vyorkin/github/starter-kit/node_modules/postcss/lib/lazy-result.js:129:15)
at processing.Promise.then._this2.processed (/Users/vyorkin/github/starter-kit/node_modules/postcss/lib/lazy-result.js:155:20)
at new Promise (/Users/vyorkin/github/starter-kit/node_modules/core-js/modules/es6.promise.js:197:7)
at LazyResult.async (/Users/vyorkin/github/starter-kit/node_modules/postcss/lib/lazy-result.js:152:27)
at LazyResult.then (/Users/vyorkin/github/starter-kit/node_modules/postcss/lib/lazy-result.js:75:21)
at Object.module.exports (/Users/vyorkin/github/starter-kit/node_modules/postcss-loader/index.js:47:32)
@ ./src/scripts/pages/examples/Counter/components/Counter/style.css 4:14-178 13:2-17:4 14:20-184
But: using stylelintrc from: /Users/vyorkin/github/starter-kit/.stylelintrc
and its really there. Works from CLI
you need to have rules, even if they're empty:
require('postcss-import')({
addDependencyTo: webpack,
path: ['node_modules', 'src'],
plugins: [
require('stylelint')({
extends: 'stylelint-config-standard',
rules: []
})
]
}),
require('stylelint')({
extends: 'stylelint-config-standard',
rules: []
}),
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I really struggled with getting the PostCSS version to work with Scss. I can get it working on the CLI and mostly in Node but not when using PostCSS :( The webpack config i use is: https://github.com/onespacemedia/cms/blob/develop/cms/project_template/webpack.config.js