Permalink
Browse files

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.
  • Loading branch information...
1 parent fee8a12 commit be225337ce727b1fc682f8384f40144ce2603fd3 @mramato mramato committed Jun 19, 2017
Showing with 14 additions and 35 deletions.
  1. +9 −0 .eslintignore
  2. +1 −0 .gitignore
  3. +1 −1 .travis.yml
  4. +0 −30 gulpfile.js
  5. +1 −1 index.release.html
  6. +2 −3 package.json
View
@@ -0,0 +1,9 @@
+Apps/HelloWorld.html
+Apps/Sandcastle/ThirdParty/**
+Build/**
+Documentation/**
+Source/Shaders/**
+Source/ThirdParty/**
+Source/Workers/cesiumWorkerBootstrapper.js
+ThirdParty/**
+Tools/**
View
@@ -5,6 +5,7 @@
/cesium-*.tgz
.DS_Store
Thumbs.db
+.eslintcache
/Apps/CesiumViewer/Gallery/gallery-index.js
View
@@ -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'
View
@@ -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.
View
@@ -106,7 +106,7 @@
</div>
<script type="text/javascript">
if (window.location.protocol === 'file:') {
- document.body.innerHTML = ""
+ document.body.innerHTML = "";
document.write('<p><b>This file must be hosted in a web server.</br>');
document.write('See our <a href="https://cesiumjs.org/2013/04/12/Cesium-up-and-running/">Getting Started</a> ');
document.write('tutorial for a step-by-step guide.</b></p>');
View
@@ -39,13 +39,13 @@
"compressible": "^2.0.9",
"compression": "^1.6.2",
"electron": "^1.6.1",
+ "eslint": "^4.0.0",
"eslint-plugin-html": "^3.0.0",
"event-stream": "^3.3.4",
"express": "^4.15.0",
"globby": "^6.1.0",
"glsl-strip-comments": "^1.0.0",
"gulp": "^3.9.1",
- "gulp-eslint": "^4.0.0",
"gulp-insert": "^0.5.0",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
@@ -83,8 +83,7 @@
"requirejs": "gulp requirejs",
"generateDocumentation": "gulp generateDocumentation",
"instrumentForCoverage": "gulp instrumentForCoverage",
- "eslint": "gulp eslint",
- "eslint-watch": "gulp eslint-watch",
+ "eslint": "eslint ./**/*.js ./**/*.html --cache --quiet",
"makeZipFile": "gulp makeZipFile",
"minify": "gulp minify",
"minifyRelease": "gulp minifyRelease",

0 comments on commit be22533

Please sign in to comment.