Stylelint as PostCSS plugin

I use stylelint as PostCSS plugin. I won’t be describe all benefits of CSS linting. I only want to show the easiest way to start linting your CSS file.

var stylelintConfig = {
 "rules": {
 "block-no-empty": true,
 "color-no-invalid-hex": true,
 "declaration-colon-space-after": "always",
 "declaration-colon-space-before": "never",
 "function-comma-space-after": "always",
 "function-url-quotes": "double",
 "media-feature-colon-space-after": "always",
 "media-feature-colon-space-before": "never",
 "media-feature-name-no-vendor-prefix": true,
 "max-empty-lines": 2,
 "number-leading-zero": "never",
 "number-no-trailing-zeros": true,
 "property-no-vendor-prefix": true,
 "selector-list-comma-newline-after": "always-multi-line",
 "selector-no-id": true,
 "string-quotes": "double",
 "value-no-vendor-prefix": true,
 "function-linear-gradient-no-nonstandard-direction": true,
 "selector-no-universal": true,
 "indentation": 4,
 }
};

module.exports = function(grunt) {

grunt.initConfig({

 postcss: {

 options: {
 processors: [
 require('precss')(),
 require('postcss-cssnext')(),
 require('postcss-alias')(),
 require('postcss-bem')(),
 ]
 },
 dist: {
 src: 'before/*.css',
 dest: 'styles/styles.css'
 },
 lint: {
 options: {
 processors: [
 require("stylelint")(stylelintConfig),
 require("postcss-reporter")({ clearMessages: true })
 ]
 },
 src: 'styles/*.css'
 }
 }

 });

 grunt.loadNpmTasks('grunt-postcss');
};

Most wonderful moment that you can config all rules which you need.