Skip to content

Commit

Permalink
Use cmd version of eslint and enable caching
Browse files Browse the repository at this point in the history
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
mramato committed Jun 19, 2017
1 parent fee8a12 commit be22533
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 35 deletions.
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Apps/HelloWorld.html
Apps/Sandcastle/ThirdParty/**
Build/**
Documentation/**
Source/Shaders/**
Source/ThirdParty/**
Source/Workers/cesiumWorkerBootstrapper.js
ThirdParty/**
Tools/**
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/cesium-*.tgz
.DS_Store
Thumbs.db
.eslintcache

/Apps/CesiumViewer/Gallery/gallery-index.js

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
30 changes: 0 additions & 30 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion index.release.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>');
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit be22533

Please sign in to comment.