Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp eslint #1538

Merged
merged 3 commits into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const inline_svg = require('postcss-inline-svg');
const gulpTsLint = require('gulp-tslint');
const gulpEslint = require('gulp-eslint7');
const tslint = require('tslint');
const html_minifier= require('html-minifier').minify;

Expand All @@ -35,19 +36,22 @@ gulp.task('min_styl', min_styl);
gulp.task('livereload-server', livereload_server);
gulp.task('background_webpack', background_webpack);
gulp.task('watch_tslint', watch_tslint);
gulp.task('watch_eslint', watch_eslint);
gulp.task('dev-server', dev_server);
gulp.task('tslint', lint);
gulp.task('eslint', eslint);
gulp.task('minify-index', minify_index);
gulp.task('default',
gulp.task('default',
gulp.parallel(
'dev-server',
"livereload-server",
"background_webpack",
"build_styl",
"watch_styl",
"watch_dist_js",
"watch_html",
"watch_tslint"
'dev-server',
"livereload-server",
"background_webpack",
"build_styl",
"watch_styl",
"watch_dist_js",
"watch_html",
"watch_tslint",
"watch_eslint"
)
);

Expand All @@ -56,26 +60,30 @@ function reload(done) {
livereload.reload();
done();
}
function watch_dist_js(done) {
function watch_dist_js(done) {
gulp.watch(['dist/*.js'], reload);
done();
done();
}
function watch_html(done) {
function watch_html(done) {
gulp.watch(['src/*.html'], reload);
done();
done();
}
function watch_styl(done) {
function watch_styl(done) {
gulp.watch(['src/**/*.styl', 'src/*.styl'], build_styl);
done();
done();
}
function livereload_server(done) {
function livereload_server(done) {
livereload.listen(35701);
done();
done();
}
function watch_tslint(done) {
function watch_tslint(done) {
gulp.watch(ts_sources, lint);
done();
};
function watch_eslint(done) {
gulp.watch(ts_sources, eslint);
done();
}

let lint_debounce = null;
function lint(done) {
Expand Down Expand Up @@ -104,6 +112,13 @@ function lint(done) {
done();
}

function eslint() {
return gulp.src(ts_sources)
.pipe(gulpEslint())
.pipe(gulpEslint.format())
.pipe(gulpEslint.failAfterError());
}

function build_styl(done) {
pump([gulp.src('./src/ogs.styl'),
sourcemaps.init(),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"goban": "=0.5.56",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.3.0",
"gulp-eslint7": "^0.3.2",
"gulp-livereload": "^4.0.2",
"gulp-postcss": "^9.0.0",
"gulp-rename": "^2.0.0",
Expand Down
9 changes: 9 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4941,6 +4941,15 @@ gulp-cli@^2.2.0:
v8flags "^3.2.0"
yargs "^7.1.0"

gulp-eslint7@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/gulp-eslint7/-/gulp-eslint7-0.3.2.tgz#713617567a920b25ac6a5a240be73ca36ad49cd6"
integrity sha512-zDb/sz8sXmP2jv6BTM9mH1DhoOX7nq5Q3ESHelqw+Fqd7lbU0GoOUVte3NvpqP+oWaGn2+t0AKEs0kXEQRMUIw==
dependencies:
eslint "^7.32.0"
fancy-log "^1.3.3"
plugin-error "^1.0.1"

gulp-livereload@^4.0.2:
version "4.0.2"
resolved "https://registry.yarnpkg.com/gulp-livereload/-/gulp-livereload-4.0.2.tgz#fc8a75c7511cd65afd2202cbcdc8bb0f8dde377b"
Expand Down