Skip to content

Commit

Permalink
Add Stylelint
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagonoronha committed Feb 8, 2018
1 parent bc62c11 commit be30d7c
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"rules": {
"indentation": "tab",
"color-hex-case": "lower",
"color-no-invalid-hex": true,

"function-calc-no-unspaced-operator": true,
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-name-case": "lower",
"function-url-quotes": "always",
"function-whitespace-after": "always",

"number-leading-zero": "always",
"number-no-trailing-zeros": true,
"length-zero-no-unit": true,

"string-no-newline": true,
"string-quotes": "single",

"unit-case": "lower",
"unit-no-unknown": true,
"unit-whitelist": ["px", "%", "deg", "ms", "em", "vh", "vw", "rem", "s", "ex", "pt", "cm"],

"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",

"shorthand-property-no-redundant-values": true,

"property-case": "lower",

"declaration-block-no-duplicate-properties": [true, { "severity": "warning" } ],
"declaration-block-trailing-semicolon": "always",
"declaration-block-single-line-max-declarations": 0,
"declaration-block-semicolon-space-before": "never",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-newline-before": "never-multi-line",
"declaration-block-semicolon-newline-after": "always-multi-line",

"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always-multi-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always-multi-line",
"block-opening-brace-space-before": "always",

"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-parentheses-space-inside": "always",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-colon-notation": "double",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower"
}
}
12 changes: 12 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ module.exports = function( grunt ) {
]
},

// Sass linting with Stylelint.
stylelint: {
options: {
configFile: '.stylelintrc'
},
all: [
'assets/sass/**/*.scss',
'!assets/sass/vendors/**/*.scss'
]
},

// Minify .js files.
uglify: {
options: {
Expand Down Expand Up @@ -418,6 +429,7 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks( 'grunt-rtlcss' );
grunt.loadNpmTasks( 'grunt-postcss' );
grunt.loadNpmTasks( 'grunt-contrib-compress' );
grunt.loadNpmTasks( 'grunt-stylelint' );


// Register tasks
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
"grunt-postcss": "^0.8.0",
"grunt-rtlcss": "~2.0.1",
"grunt-sass": "~2.0.0",
"grunt-stylelint": "~0.9.0",
"grunt-wp-i18n": "^1.0.0",
"node-bourbon": "~4.2.8",
"node-sass": "~4.5.2",
"stylelint": "~8.2.0",
"susy": "~2.2.12"
},
"engines": {
Expand Down

0 comments on commit be30d7c

Please sign in to comment.