Skip to content

Commit

Permalink
Replace JSHint with ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
eriwen committed Jan 6, 2020
1 parent 7a49bbd commit 04595b5
Show file tree
Hide file tree
Showing 15 changed files with 5,880 additions and 3,125 deletions.
37 changes: 37 additions & 0 deletions .eslintrc.yml
@@ -0,0 +1,37 @@
env:
browser: true
commonjs: true
node: true
extends: 'eslint:recommended'
globals:
afterEach: false
beforeEach: false
define: false
describe: false
expect: false
it: false
jasmine: false
ES6Promise: false
Promise: false
SourceMap: false
StackFrame: false
StackTraceGPS: false
parserOptions:
ecmaVersion: 5
rules:
indent:
- error
- 4
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- always
no-console:
- error
- allow:
- error
28 changes: 0 additions & 28 deletions .jscsrc

This file was deleted.

52 changes: 0 additions & 52 deletions .jshintrc

This file was deleted.

8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -13,9 +13,9 @@ addons:
services:
- xvfb
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
before_script:
- npm install
- npm install
script:
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then gulp ci; else gulp test-pr; fi
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then npm run lint && gulp ci; else gulp test-pr; fi
2 changes: 1 addition & 1 deletion dist/stacktrace-gps-with-polyfills.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/stacktrace-gps-with-polyfills.min.js.map

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions dist/stacktrace-gps.js
Expand Up @@ -129,7 +129,8 @@
var sourceMappingUrlRegExp = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/mg;
var lastSourceMappingUrl;
var matchSourceMappingUrl;
while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) { // jshint ignore:line
// eslint-disable-next-line no-cond-assign
while (matchSourceMappingUrl = sourceMappingUrlRegExp.exec(source)) {
lastSourceMappingUrl = matchSourceMappingUrl[1];
}
if (lastSourceMappingUrl) {
Expand Down Expand Up @@ -232,7 +233,7 @@
* @returns {Promise} that resolves a SourceMapConsumer
*/
this._getSourceMapConsumer = function _getSourceMapConsumer(sourceMappingURL, defaultSourceRoot) {
return new Promise(function(resolve, reject) {
return new Promise(function(resolve) {
if (this.sourceMapConsumerCache[sourceMappingURL]) {
resolve(this.sourceMapConsumerCache[sourceMappingURL]);
} else {
Expand Down Expand Up @@ -270,6 +271,7 @@

this.findFunctionName(mappedStackFrame)
.then(resolve, resolveMappedStackFrame)
// eslint-disable-next-line no-unexpected-multiline
['catch'](resolveMappedStackFrame);
}.bind(this), reject);
}.bind(this));
Expand Down Expand Up @@ -330,8 +332,8 @@
.then(function(sourceMapConsumer) {
return _extractLocationInfoFromSourceMapSource(stackframe, sourceMapConsumer, sourceCache)
.then(resolve)['catch'](function() {
resolve(stackframe);
});
resolve(stackframe);
});
});
}.bind(this), reject)['catch'](reject);
}.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion dist/stacktrace-gps.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/stacktrace-gps.min.js.map

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions gulpfile.js
Expand Up @@ -2,7 +2,6 @@ var concat = require('gulp-concat');
var coveralls = require('gulp-coveralls');
var del = require('del');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var karma = require('karma');
var path = require('path');
var runSequence = require('run-sequence');
Expand All @@ -20,13 +19,6 @@ var dependencies = [
];
var source = 'stacktrace-gps.js';

gulp.task('lint', function() {
return gulp.src(source)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});

gulp.task('webpack-source-consumer', function() {
return webpack({
entry: './node_modules/source-map/lib/source-map-consumer.js',
Expand Down Expand Up @@ -88,13 +80,13 @@ gulp.task('dist', ['copy', 'webpack-source-consumer'], function() {

gulp.task('clean', del.bind(null, ['build', 'coverage', 'dist']));

gulp.task('pr', ['lint', 'test-pr']);
gulp.task('pr', ['test-pr']);

gulp.task('ci', ['lint', 'test-ci'], function() {
gulp.task('ci', ['test-ci'], function() {
gulp.src('./coverage/**/lcov.info')
.pipe(coveralls());
});

gulp.task('default', ['clean'], function(cb) {
runSequence('lint', ['copy', 'dist'], 'test', cb);
runSequence(['copy', 'dist'], 'test', cb);
});
108 changes: 24 additions & 84 deletions karma.conf.ci.js
Expand Up @@ -5,45 +5,7 @@ module.exports = function(config) {
process.exit(1);
}

// Commented some of these out just so CI doesn't take forever.
// Check out https://saucelabs.com/platforms for all browser/platform combos
var customLaunchers = {
slIOS8: {
base: 'SauceLabs',
browserName: 'iPhone',
platform: 'OS X 10.10',
version: '8.4'
},
slIOS9: {
base: 'SauceLabs',
browserName: 'iPhone',
platform: 'OS X 10.11',
version: '9.2'
},
slIOS10: {
base: 'SauceLabs',
browserName: 'iPhone',
platform: 'macOS 10.12',
version: '10.2'
},
slAndroid4: {
base: 'SauceLabs',
browserName: 'Android',
platform: 'Linux',
version: '4.4'
},
slAndroid5: {
base: 'SauceLabs',
browserName: 'Android',
platform: 'Linux',
version: '5.1'
},
slAndroid6: {
base: 'SauceLabs',
browserName: 'Android',
platform: 'Linux',
version: '6.0'
},
slChrome: {
base: 'SauceLabs',
browserName: 'chrome',
Expand All @@ -59,39 +21,22 @@ module.exports = function(config) {
browserName: 'firefox',
version: 'latest'
},
slSafari8: {
slFirefoxBeta: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.10',
version: '8.0'
},
slSafari9: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'OS X 10.11',
version: '9.0'
browserName: 'firefox',
version: 'beta'
},
slSafari10: {
slSafari: {
base: 'SauceLabs',
browserName: 'safari',
platform: 'macOS 10.12',
version: '10.0'
},
slOpera: {
base: 'SauceLabs',
browserName: 'opera'
},
slEdge14: {
base: 'SauceLabs',
browserName: 'microsoftedge',
platform: 'Windows 10',
version: '14.14393'
platform: 'OS X 10.14',
version: 'latest'
},
slEdge13: {
slEdge: {
base: 'SauceLabs',
browserName: 'microsoftedge',
platform: 'Windows 10',
version: '13.10586'
version: 'latest'
},
slIE11: {
base: 'SauceLabs',
Expand All @@ -102,28 +47,23 @@ module.exports = function(config) {
slIE10: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 8',
platform: 'Windows 7',
version: '10'
},
slIE9: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '10',
'x-ua-compatible': 'IE=EmulateIE9'
},
slIE8: {
base: 'SauceLabs',
browserName: 'internet explorer',
platform: 'Windows 7',
version: '10',
'x-ua-compatible': 'IE=EmulateIE8'
}
// slIE9: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// platform: 'Windows 7',
// version: '9.0'
// }
// Too unreliable on Sauce :(
// slIE8: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// platform: 'Windows XP',
// version: '8.0'
// }
//slIE7: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// platform: 'Windows XP',
// version: '7'
//}
};

config.set({
Expand Down Expand Up @@ -156,7 +96,7 @@ module.exports = function(config) {
},
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
reporters: ['dots', 'saucelabs', 'coverage'],
reporters: ['dots', 'saucelabs', 'coverage', 'coveralls'],
preprocessors: {
'stacktrace-gps.js': 'coverage'
},
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Expand Up @@ -20,7 +20,7 @@ module.exports = function(config) {
flags: ['--no-sandbox']
}
},
browsers: ['PhantomJS2'],
browsers: ['PhantomJS'],
singleRun: false
});
};

0 comments on commit 04595b5

Please sign in to comment.