diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..fcf4081 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "cesium/node" +} diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index eff7139..c6cc8c8 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/.idea/jsLinters/jshint.xml b/.idea/jsLinters/jshint.xml deleted file mode 100644 index aed467c..0000000 --- a/.idea/jsLinters/jshint.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index bdff25a..0000000 --- a/.jshintrc +++ /dev/null @@ -1,60 +0,0 @@ -{ - "bitwise": false, - "camelcase": false, - "curly": true, - "eqeqeq": true, - "forin": true, - "freeze": true, - "immed": true, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "nonbsp": true, - "nonew": true, - "plusplus": false, - "quotmark": false, - "undef": true, - "unused": "strict", - "strict": true, - "asi": false, - "boss": false, - "debug": false, - "eqnull": false, - "moz": false, - "evil": false, - "expr": false, - "funcscope": false, - "globalstrict": false, - "iterator": false, - "lastsemic": false, - "laxbreak": false, - "laxcomma": false, - "loopfunc": false, - "multistr": true, - "noyield": false, - "notypeof": false, - "proto": false, - "scripturl": false, - "shadow": false, - "sub": false, - "supernew": false, - "validthis": false, - "browser": false, - "browserify": false, - "couch": false, - "devel": true, - "dojo": false, - "jasmine": false, - "jquery": false, - "mocha": true, - "mootools": false, - "node": true, - "nonstandard": false, - "prototypejs": false, - "qunit": false, - "rhino": false, - "shelljs": false, - "worker": false, - "wsh": false, - "yui": false -} diff --git a/.npmignore b/.npmignore index 26f16d5..8d9d85c 100644 --- a/.npmignore +++ b/.npmignore @@ -6,7 +6,7 @@ /test /output .editorconfig -.jshintrc +.eslintrc.json .npmignore .travis.yml gulpfile.js diff --git a/.travis.yml b/.travis.yml index a066d24..8e939a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ node_js: - "4" - "6" script: - - npm run jsHint -- --failTaskOnError + - npm run eslint -- --failTaskOnError - npm run test -- --failTaskOnError --suppressPassed after_success: diff --git a/README.md b/README.md index 565a4bb..0d9e3cd 100644 --- a/README.md +++ b/README.md @@ -55,13 +55,13 @@ Run the tests: ``` npm run test ``` -To run JSHint on the entire codebase, run: +To run ESLint on the entire codebase, run: ``` -npm run jsHint +npm run eslint ``` -To run JSHint automatically when a file is saved, run the following and leave it open in a console window: +To run ESLint automatically when a file is saved, run the following and leave it open in a console window: ``` -npm run jsHint-watch +npm run eslint-watch ``` ## Running Test Coverage diff --git a/gulpfile.js b/gulpfile.js index 8d12058..01c8b5c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,7 +4,7 @@ var Cesium = require('cesium'); var child_process = require('child_process'); var fsExtra = require('fs-extra'); var gulp = require('gulp'); -var gulpJshint = require('gulp-jshint'); +var eslint = require('gulp-eslint'); var Jasmine = require('jasmine'); var JasmineSpecReporter = require('jasmine-spec-reporter').SpecReporter; var open = require('open'); @@ -20,23 +20,26 @@ var environmentSeparator = process.platform === 'win32' ? ';' : ':'; var nodeBinaries = path.join(__dirname, 'node_modules', '.bin'); process.env.PATH += environmentSeparator + nodeBinaries; -var jsHintFiles = ['**/*.js', '!node_modules/**', '!coverage/**', '!doc/**']; +var esLintFiles = ['**/*.js', '!node_modules/**', '!coverage/**', '!doc/**']; var specFiles = ['**/*.js', '!node_modules/**', '!coverage/**', '!doc/**', '!bin/**']; -gulp.task('jsHint', function () { - var stream = gulp.src(jsHintFiles) - .pipe(gulpJshint()) - .pipe(gulpJshint.reporter('jshint-stylish')); - +gulp.task('eslint', function () { + var stream = gulp.src(esLintFiles) + .pipe(eslint()) + .pipe(eslint.format()); if (argv.failTaskOnError) { - stream = stream.pipe(gulpJshint.reporter('fail')); + stream = stream.pipe(eslint.failAfterError()); } return stream; }); -gulp.task('jsHint-watch', function () { - gulp.watch(jsHintFiles, ['jsHint']); +gulp.task('eslint-watch', function() { + gulp.watch(esLintFiles).on('change', function(event) { + gulp.src(event.path) + .pipe(eslint()) + .pipe(eslint.format()); + }); }); gulp.task('test', function (done) { diff --git a/index.js b/index.js index f0c4b18..b157a83 100644 --- a/index.js +++ b/index.js @@ -1 +1,2 @@ +'use strict'; module.exports = require('./lib/obj2gltf'); diff --git a/package.json b/package.json index 0d37800..40fd641 100644 --- a/package.json +++ b/package.json @@ -38,21 +38,20 @@ }, "devDependencies": { "coveralls": "^2.12.0", + "eslint-config-cesium": "^1.0.0", "gulp": "^3.9.1", - "gulp-jshint": "^2.0.4", + "gulp-eslint": "^4.0.0", "istanbul": "^0.4.5", "jasmine": "^2.5.3", "jasmine-spec-reporter": "^4.1.0", "jsdoc": "^3.4.3", - "jshint": "^2.9.4", - "jshint-stylish": "^2.2.1", "open": "^0.0.5", "requirejs": "^2.3.3" }, "scripts": { "jsdoc": "jsdoc ./lib -R ./README.md -d doc", - "jsHint": "gulp jsHint", - "jsHint-watch": "gulp jsHint-watch", + "eslint": "gulp eslint", + "eslint-watch": "gulp eslint-watch", "test": "gulp test", "test-watch": "gulp test-watch", "coverage": "gulp coverage", diff --git a/specs/.eslintrc.json b/specs/.eslintrc.json new file mode 100644 index 0000000..92eb4d1 --- /dev/null +++ b/specs/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "extends": "../.eslintrc.json", + "env": { + "jasmine": true + }, + "rules": { + "no-unused-vars": "off" + } +} diff --git a/specs/.jshintrc b/specs/.jshintrc deleted file mode 100644 index d921aae..0000000 --- a/specs/.jshintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../.jshintrc", - "jasmine": true, - "unused": false -} diff --git a/specs/matchers/addDefaultMatchers.js b/specs/matchers/addDefaultMatchers.js index a1c6410..7a6dcc2 100644 --- a/specs/matchers/addDefaultMatchers.js +++ b/specs/matchers/addDefaultMatchers.js @@ -1,6 +1,6 @@ //This file is a copy of https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Specs/addDefaultMatchers.js -/*global define*/ -/*jshint unused:false*/ +/*eslint strict: ["error", "function"]*/ +/*eslint-env amd*/ define([ './equals', 'Cesium/Core/defined', diff --git a/specs/matchers/customizeJasmine.js b/specs/matchers/customizeJasmine.js index 8630965..a7b51c2 100644 --- a/specs/matchers/customizeJasmine.js +++ b/specs/matchers/customizeJasmine.js @@ -1,4 +1,5 @@ -/*global define*/ +/*eslint strict: ["error", "function"]*/ +/*eslint-env amd*/ define([ './addDefaultMatchers', './equalsMethodEqualityTester' diff --git a/specs/matchers/equals.js b/specs/matchers/equals.js index 99203d0..3ce5e26 100644 --- a/specs/matchers/equals.js +++ b/specs/matchers/equals.js @@ -1,5 +1,6 @@ //This file is a copy of https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Specs/equals.js -/*global define*/ +/*eslint strict: ["error", "function"]*/ +/*eslint-env amd*/ define([ 'Cesium/Core/FeatureDetection' ], function( diff --git a/specs/matchers/equalsMethodEqualityTester.js b/specs/matchers/equalsMethodEqualityTester.js index b9fd40e..4b61895 100644 --- a/specs/matchers/equalsMethodEqualityTester.js +++ b/specs/matchers/equalsMethodEqualityTester.js @@ -1,5 +1,6 @@ //This file is a copy of https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Specs/equalsMethodEqualityTester.js -/*global define*/ +/*eslint strict: ["error", "function"]*/ +/*eslint-env amd*/ define([ 'Cesium/Core/defined' ], function(