Skip to content

Commit c5680c0

Browse files
devversionandrewseguin
authored andcommitted
build: combine multiple stylelint tasks (#4335)
* Combines the multiple stylelint tasks into a single one. Stylelint supports globs using `globby`.
1 parent 5d03c1a commit c5680c0

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tools/gulp/tasks/lint.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ import gulp = require('gulp');
22
import {execNodeTask} from '../util/task_helpers';
33
import {DIST_MATERIAL} from '../constants';
44

5-
gulp.task('lint', ['tslint', 'stylelint', 'madge', 'dashboardlint']);
5+
/** Glob that matches all SCSS or CSS files that should be linted. */
6+
const stylesGlob = '+(tools|src)/**/*.+(css|scss)';
7+
8+
/** List of flags that will passed to the different TSLint tasks. */
9+
const tsLintBaseFlags = [
10+
'-c', 'tslint.json', '+(src|e2e|tools)/**/*.ts', '--exclude', '**/node_modules/**/*'
11+
];
12+
13+
gulp.task('lint', ['tslint', 'stylelint', 'madge']);
614

715
/** Task that runs madge to detect circular dependencies. */
816
gulp.task('madge', ['material:clean-build'], execNodeTask('madge', ['--circular', DIST_MATERIAL]));
917

1018
/** Task to lint Angular Material's scss stylesheets. */
1119
gulp.task('stylelint', execNodeTask(
12-
'stylelint', ['src/**/*.scss', '--config', 'stylelint-config.json', '--syntax', 'scss']
20+
'stylelint', [stylesGlob, '--config', 'stylelint-config.json', '--syntax', 'scss']
1321
));
1422

15-
gulp.task('dashboardlint', execNodeTask(
16-
'stylelint', ['tools/screenshot-test/**/*.css', '--config', 'stylelint-config.json',
17-
'--syntax', 'scss']
18-
));
19-
20-
const tsLintBaseFlags = ['-c', 'tslint.json', '+(src|e2e|tools)/**/*.ts', '--exclude',
21-
'**/node_modules/**/*'];
22-
2323
/** Task to run TSLint against the e2e/ and src/ directories. */
2424
gulp.task('tslint', execNodeTask('tslint', tsLintBaseFlags));
2525

0 commit comments

Comments
 (0)