mirror of
https://gitlab.silvrtree.co.uk/martind2000/ft.git
synced 2025-01-26 22:56:16 +00:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import gulp from 'gulp';
|
|
import project from '../aurelia.json';
|
|
import eslint from 'gulp-eslint';
|
|
import {CLIOptions} from 'aurelia-cli';
|
|
|
|
// linting configuration in is .eslintrc.json file in project root folder
|
|
|
|
function lintJsSrc() {
|
|
if (CLIOptions.hasFlag('watch')) {
|
|
return gulp.src(project.jsLinter.source)
|
|
.pipe(eslint())
|
|
.pipe(eslint.format());
|
|
}
|
|
return gulp.src(project.jsLinter.source)
|
|
.pipe(eslint())
|
|
.pipe(eslint.format())
|
|
.pipe(eslint.failAfterError());
|
|
}
|
|
|
|
// linting tests is les strict - console.log and
|
|
function lintJsTests() {
|
|
if (CLIOptions.hasFlag('watch')) {
|
|
return gulp.src(project.jsLinter.testSource)
|
|
.pipe(eslint({
|
|
'rules': {
|
|
'no-console': ['warn'],
|
|
'no-unused-vars': ['warn'],
|
|
'quotes': ['off', 'single']
|
|
}
|
|
}))
|
|
.pipe(eslint.format());
|
|
}
|
|
return gulp.src(project.jsLinter.testSource)
|
|
.pipe(eslint({
|
|
'rules': {
|
|
'no-console': ['warn'],
|
|
'no-unused-vars': ['warn'],
|
|
'quotes': ['off', 'single']
|
|
}
|
|
}))
|
|
.pipe(eslint.format())
|
|
.pipe(eslint.failAfterError());
|
|
}
|
|
|
|
export default gulp.parallel(lintJsSrc, lintJsTests);
|