From c5680c0fa03ad3cdb75fd1587e4a0694ba009199 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 3 May 2017 01:38:03 +0200 Subject: [PATCH] build: combine multiple stylelint tasks (#4335) * Combines the multiple stylelint tasks into a single one. Stylelint supports globs using `globby`. --- tools/gulp/tasks/lint.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/gulp/tasks/lint.ts b/tools/gulp/tasks/lint.ts index 0b997e9bfd1d..5eb362541f16 100644 --- a/tools/gulp/tasks/lint.ts +++ b/tools/gulp/tasks/lint.ts @@ -2,24 +2,24 @@ import gulp = require('gulp'); import {execNodeTask} from '../util/task_helpers'; import {DIST_MATERIAL} from '../constants'; -gulp.task('lint', ['tslint', 'stylelint', 'madge', 'dashboardlint']); +/** Glob that matches all SCSS or CSS files that should be linted. */ +const stylesGlob = '+(tools|src)/**/*.+(css|scss)'; + +/** List of flags that will passed to the different TSLint tasks. */ +const tsLintBaseFlags = [ + '-c', 'tslint.json', '+(src|e2e|tools)/**/*.ts', '--exclude', '**/node_modules/**/*' +]; + +gulp.task('lint', ['tslint', 'stylelint', 'madge']); /** Task that runs madge to detect circular dependencies. */ gulp.task('madge', ['material:clean-build'], execNodeTask('madge', ['--circular', DIST_MATERIAL])); /** Task to lint Angular Material's scss stylesheets. */ gulp.task('stylelint', execNodeTask( - 'stylelint', ['src/**/*.scss', '--config', 'stylelint-config.json', '--syntax', 'scss'] + 'stylelint', [stylesGlob, '--config', 'stylelint-config.json', '--syntax', 'scss'] )); -gulp.task('dashboardlint', execNodeTask( - 'stylelint', ['tools/screenshot-test/**/*.css', '--config', 'stylelint-config.json', - '--syntax', 'scss'] -)); - -const tsLintBaseFlags = ['-c', 'tslint.json', '+(src|e2e|tools)/**/*.ts', '--exclude', - '**/node_modules/**/*']; - /** Task to run TSLint against the e2e/ and src/ directories. */ gulp.task('tslint', execNodeTask('tslint', tsLintBaseFlags));