Merge pull request #82 from omh1280/eslint_node

Replace JSHint with ESLint shareable config
This commit is contained in:
Matthew Amato 2017-06-12 16:05:56 -04:00 committed by GitHub
commit c82c3ec36e
17 changed files with 43 additions and 176 deletions

3
.eslintrc.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "cesium/node"
}

View File

@ -1,6 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JSHint" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="Eslint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>

View File

@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JSHintConfiguration" version="2.8.0" use-config-file="true">
<option asi="false" />
<option bitwise="true" />
<option boss="false" />
<option browser="true" />
<option browserify="false" />
<option camelcase="false" />
<option couch="false" />
<option curly="true" />
<option debug="false" />
<option devel="false" />
<option dojo="false" />
<option elision="false" />
<option enforceall="false" />
<option eqeqeq="true" />
<option eqnull="false" />
<option es3="false" />
<option es5="false" />
<option esnext="false" />
<option evil="false" />
<option expr="false" />
<option forin="true" />
<option freeze="false" />
<option funcscope="false" />
<option futurehostile="false" />
<option gcl="false" />
<option globalstrict="false" />
<option immed="false" />
<option iterator="false" />
<option jasmine="false" />
<option jquery="false" />
<option lastsemic="false" />
<option latedef="false" />
<option laxbreak="false" />
<option laxcomma="false" />
<option loopfunc="false" />
<option maxerr="50" />
<option mocha="false" />
<option mootools="false" />
<option moz="false" />
<option multistr="false" />
<option newcap="false" />
<option noarg="true" />
<option nocomma="false" />
<option node="false" />
<option noempty="true" />
<option nomen="false" />
<option nonbsp="false" />
<option nonew="true" />
<option nonstandard="false" />
<option notypeof="false" />
<option noyield="false" />
<option onevar="false" />
<option passfail="false" />
<option phantom="false" />
<option plusplus="false" />
<option proto="false" />
<option prototypejs="false" />
<option qunit="false" />
<option quotmark="false" />
<option rhino="false" />
<option scripturl="false" />
<option shadow="false" />
<option shelljs="false" />
<option singleGroups="false" />
<option smarttabs="false" />
<option strict="true" />
<option sub="false" />
<option supernew="false" />
<option trailing="false" />
<option typed="false" />
<option undef="true" />
<option unused="false" />
<option validthis="false" />
<option white="false" />
<option withstmt="false" />
<option worker="false" />
<option wsh="false" />
<option yui="false" />
</component>
</project>

View File

@ -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
}

View File

@ -6,7 +6,7 @@
/test
/output
.editorconfig
.jshintrc
.eslintrc.json
.npmignore
.travis.yml
gulpfile.js

View File

@ -3,7 +3,7 @@ node_js:
- "4"
- "6"
script:
- npm run jsHint -- --failTaskOnError
- npm run eslint -- --failTaskOnError
- npm run test -- --failTaskOnError --suppressPassed
after_success:

View File

@ -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

View File

@ -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) {

View File

@ -1 +1,2 @@
'use strict';
module.exports = require('./lib/obj2gltf');

View File

@ -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",

6
specs/.eslintrc.json Normal file
View File

@ -0,0 +1,6 @@
{
"extends": "../.eslintrc.json",
"env": {
"jasmine": true
}
}

View File

@ -1,5 +0,0 @@
{
"extends": "../.jshintrc",
"jasmine": true,
"unused": false
}

View File

@ -5,7 +5,6 @@ var os = require('os');
var path = require('path');
var Promise = require('bluebird');
var obj2gltf = require('../../lib/obj2gltf');
var writeUris = require('../../lib/writeUris');
var objPath = 'specs/data/box-textured/box-textured.obj';
var gltfPath = 'specs/data/box-textured/box-textured.gltf';

View File

@ -1,6 +1,7 @@
//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*/
/*eslint-disable no-unused-vars*/
define([
'./equals',
'Cesium/Core/defined',

View File

@ -1,4 +1,5 @@
/*global define*/
/*eslint strict: ["error", "function"]*/
/*eslint-env amd*/
define([
'./addDefaultMatchers',
'./equalsMethodEqualityTester'

View File

@ -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(

View File

@ -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(