From a5dc5eba7b399828f0a491eb7c98a26bb28307d5 Mon Sep 17 00:00:00 2001 From: Oleg Pimenov Date: Fri, 5 Oct 2018 04:55:09 +0300 Subject: [PATCH] feat(build): added gulp stylelint task --- package.json | 2 +- tools/gulp/tasks/lint.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index bb201aa73..0dea098b4 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "changelog": "gulp changelog", "publish": "ts-node --project ./scripts/tsconfig.deploy.json ./scripts/deploy/publish-artifacts.ts", "linter:lib": "gulp tslint", - "linter:styles": "stylelint --syntax scss \"./**/*.scss\"", + "linter:styles": "gulp stylelint", "server-dev": "webpack-dev-server --config tools/webpack/webpack.config.js", "server-dev:badge": "npm run server-dev -- --env.component badge", "server-dev:button": "npm run server-dev -- --env.component button", diff --git a/tools/gulp/tasks/lint.ts b/tools/gulp/tasks/lint.ts index 5ec0fb4f3..040b122aa 100644 --- a/tools/gulp/tasks/lint.ts +++ b/tools/gulp/tasks/lint.ts @@ -11,6 +11,11 @@ import { execNodeTask } from '../utils/helpers'; /* tslint:disable:no-var-requires */ const madge = require('madge'); +/** Globs that matchall SCSS or CSS files that should be linted. */ +const styleGlobs = [ + 'src/**/*.+(css|scss)' +]; + const tsLintBaseFlags = ['-c', 'tslint.json', '--project', './tsconfig.json']; /** Path to the output of the Mosaic package. */ @@ -23,6 +28,10 @@ task('lint', ['tslint', 'madge']); task('tslint', execNodeTask('tslint', tsLintBaseFlags)); +task('stylelint', execNodeTask( + 'stylelint', [...styleGlobs, '--config', '.stylelintrc', '--syntax', 'scss'] +)); + task('tslint:fix', execNodeTask('tslint', [...tsLintBaseFlags, '--fix'])); task('madge', ['mosaic:clean-build'], () => {