From b8aa529d29434978f511e67211d8a5ff9e2f553c Mon Sep 17 00:00:00 2001 From: sdtsui Date: Mon, 14 Aug 2017 10:03:16 +0200 Subject: [PATCH] [WIP] Add packages and tasks for linting scss --- .stylelintignore | 10 ++++++++++ .stylelintrc | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 22 +++++++++++++++++++- package.json | 8 +++++--- 4 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 .stylelintignore create mode 100644 .stylelintrc diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 000000000..854829a54 --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,10 @@ +app/ +development/ +dist/ +docs/ +fonts/ +images/ +mascara/ +node_modules/ +notices/ +test/ diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 000000000..4bf6f0572 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,52 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "color-named": "never", + "font-family-name-quotes": "always-where-recommended", + "font-weight-notation": "numeric", + "function-url-quotes": "always", + "number-leading-zero": "never", + "value-no-vendor-prefix": true, + "value-list-comma-newline-before": "never-multi-line", + "custom-property-empty-line-before": "never", + "property-no-unknown": [ + true, + { + "ignoreProperties": [ + "composes", + "all", + "-webkit-appearance" + ] + } + ], + "declaration-block-semicolon-newline-after": "always", + "block-opening-brace-newline-after": "always", + "selector-attribute-quotes": "always", + "selector-max-specificity": "0,5,2", + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": ["local", "global"] + } + ], + "at-rule-empty-line-before": [ + "always", + { + "ignore": [ + "after-comment", + "all-nested", + "blockless-group" + ] + } + ], + "indentation": [ + 2, + { + "indentInsideParens": "once-at-root-twice-in-block" + } + ], + "max-nesting-depth": 3, + "no-duplicate-selectors": true, + "no-unknown-animations": true + } +} diff --git a/gulpfile.js b/gulpfile.js index a8333e950..f8ed456b0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,10 +21,14 @@ var replace = require('gulp-replace') var mkdirp = require('mkdirp') var sass = require('gulp-sass') var autoprefixer = require('gulp-autoprefixer') +var gulpStylelint = require('gulp-stylelint') +var stylefmt = require('gulp-stylefmt') + var disableDebugTools = gutil.env.disableDebugTools var debug = gutil.env.debug + // browser reload gulp.task('dev:reload', function() { @@ -182,10 +186,26 @@ gulp.task('build:scss', function () { .pipe(autoprefixer()) .pipe(gulp.dest('ui/app/css/output')) }) -gulp.task('watch:scss', function(){ +gulp.task('watch:scss', function() { gulp.watch(['ui/app/css/**/*.scss'], gulp.series(['build:scss'])) }) +gulp.task('lint-scss', function() { + return gulp + .src('ui/app/css/itcss/**/*.scss') + .pipe(gulpStylelint({ + reporters: [ + {formatter: 'string', console: true} + ] + })); +}); + +gulp.task('fmt-scss', function () { + return gulp.src('ui/app/css/itcss/**/*.scss') + .pipe(stylefmt()) + .pipe(gulp.dest('ui/app/css/itcss')); +}); + // bundle tasks var jsDevStrings = jsFiles.map(jsFile => `dev:js:${jsFile}`) diff --git a/package.json b/package.json index 25dbc1ee9..d6b5752d0 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,8 @@ "babel-runtime": "^6.23.0", "bip39": "^2.2.0", "bluebird": "^3.5.0", - "boron": "^0.2.3", "bn.js": "^4.11.7", + "boron": "^0.2.3", "browser-passworder": "^2.0.3", "browserify-derequire": "^0.9.4", "client-sw-ready-event": "^3.3.0", @@ -85,10 +85,10 @@ "extension-link-enabler": "^1.0.0", "extensionizer": "^1.0.0", "fast-levenshtein": "^2.0.6", - "gulp-autoprefixer": "^4.0.0", - "gulp-sass": "^3.1.0", "gulp": "github:gulpjs/gulp#4.0", + "gulp-autoprefixer": "^4.0.0", "gulp-eslint": "^4.0.0", + "gulp-sass": "^3.1.0", "hat": "0.0.3", "idb-global": "^2.1.0", "identicon.js": "^2.3.1", @@ -169,6 +169,8 @@ "gulp-livereload": "^3.8.1", "gulp-replace": "^0.6.1", "gulp-sourcemaps": "^2.6.0", + "gulp-stylefmt": "^1.1.0", + "gulp-stylelint": "^4.0.0", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", "gulp-zip": "^4.0.0",