From be225337ce727b1fc682f8384f40144ce2603fd3 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Mon, 19 Jun 2017 10:55:56 -0400 Subject: [PATCH] Use cmd version of eslint and enable caching 1. Caching makes eslint only take ~3 seconds plus any files that have changed since the last time you ran it. Since it's unlikely devs are touching every tile between runs, this makes eslint much incredibly faster in the average case. Also added the genereated `.eslintcache` to git ignore. 2. Switched to the pure cli version of eslint and remove `eslint-watch`, which I'm pretty sure no one uses anyway. This simplified our usage and means we lint all js and html files by default except for the globs specifically listed in `.eslintignore` This also shaves 2-4 seconds off startup time because we're not loading gulpfile.js anymore. 3. Fixed an issue in `index.release.html`, which was previously not linted. --- .eslintignore | 9 +++++++++ .gitignore | 1 + .travis.yml | 2 +- gulpfile.js | 30 ------------------------------ index.release.html | 2 +- package.json | 5 ++--- 6 files changed, 14 insertions(+), 35 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000000..4baf9b882b1 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +Apps/HelloWorld.html +Apps/Sandcastle/ThirdParty/** +Build/** +Documentation/** +Source/Shaders/** +Source/ThirdParty/** +Source/Workers/cesiumWorkerBootstrapper.js +ThirdParty/** +Tools/** diff --git a/.gitignore b/.gitignore index 62da6df65df..3028e8e0b71 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /cesium-*.tgz .DS_Store Thumbs.db +.eslintcache /Apps/CesiumViewer/Gallery/gallery-index.js diff --git a/.travis.yml b/.travis.yml index 4ff7b4d829b..84f1c5d5742 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ script: - echo -en 'travis_fold:end:script.deployPending\\r' - echo 'eslint' && echo -en 'travis_fold:start:script.eslint\\r' - - npm run eslint -- --failTaskOnError + - npm run eslint - echo -en 'travis_fold:end:script.eslint\\r' - echo 'test webgl-stub' && echo -en 'travis_fold:start:script.test\\r' diff --git a/gulpfile.js b/gulpfile.js index 8bc4eb7ec65..b7b94fb6286 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,7 +12,6 @@ var readline = require('readline'); var request = require('request'); var globby = require('globby'); -var eslint = require('gulp-eslint'); var gulpTap = require('gulp-tap'); var rimraf = require('rimraf'); var glslStripComments = require('glsl-strip-comments'); @@ -66,17 +65,6 @@ var buildFiles = ['Specs/**/*.js', '!Specs/SpecList.js', 'Source/Shaders/**/*.glsl']; -var eslintFiles = ['Source/**/*.js', - '!Source/Shaders/**', - '!Source/ThirdParty/**', - '!Source/Workers/cesiumWorkerBootstrapper.js', - 'Apps/**/*.js', - 'Apps/Sandcastle/gallery/*.html', - '!Apps/Sandcastle/ThirdParty/**', - 'Specs/**/*.js', - 'Tools/buildTasks/**/*.js', - 'gulpfile.js']; - var filesToClean = ['Source/Cesium.js', 'Build', 'Instrumented', @@ -233,24 +221,6 @@ gulp.task('instrumentForCoverage', ['build'], function(done) { }); }); -gulp.task('eslint', ['build'], function() { - var stream = gulp.src(eslintFiles) - .pipe(eslint()) - .pipe(eslint.format()); - if (yargs.argv.failTaskOnError) { - stream = stream.pipe(eslint.failAfterError()); - } - return stream; -}); - -gulp.task('eslint-watch', function() { - gulp.watch(eslintFiles).on('change', function(event) { - gulp.src(event.path) - .pipe(eslint()) - .pipe(eslint.format()); - }); -}); - gulp.task('makeZipFile', ['release'], function() { //For now we regenerate the JS glsl to force it to be unminified in the release zip //See https://github.com/AnalyticalGraphicsInc/cesium/pull/3106#discussion_r42793558 for discussion. diff --git a/index.release.html b/index.release.html index 570b0585f98..4c1f2a88106 100644 --- a/index.release.html +++ b/index.release.html @@ -106,7 +106,7 @@