Commit c928e4fe authored by Nick Stenning's avatar Nick Stenning Committed by GitHub

Merge pull request #62 from hypothesis/use-shared-eslint-config

Use shared ESLint config
parents dbd16d1d 190b1acd
{
"env": {
"mocha": true,
"commonjs": true,
"browser": true,
},
"extends": "eslint:recommended",
"globals": {
"assert": false,
"sinon": false,
"Promise": false,
},
"rules": {
"array-callback-return": "error",
"block-scoped-var": "error",
"comma-dangle": ["error", "always-multiline"],
"consistent-this": ["error", "self"],
"consistent-return": "error",
"curly": "error",
"dot-notation": "error",
"eqeqeq": "error",
"guard-for-in": "error",
"indent": ["error", 2],
"new-cap": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-console": [
"error",
{ allow: ["warn", "error"] },
],
"no-extra-bind": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-multiple-empty-lines": "error",
"no-self-compare": "error",
"no-throw-literal": "error",
"no-undef-init": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"no-use-before-define": [
"error",
{"functions": false},
],
"no-useless-concat": "error",
"one-var-declaration-per-line": ["error", "always"],
"quotes": ["error", "single", {"avoidEscape": true}],
"semi": "error",
"strict": ["error", "safe"],
},
"parserOptions": {
"ecmaVersion": 6,
}
"extends": "hypothesis"
}
......@@ -330,5 +330,5 @@ gulp.task('upload-sourcemaps', ['build-app-js'], function () {
var release = getEnv('SENTRY_RELEASE_VERSION');
return gulp.src(['build/scripts/*.js', 'build/scripts/*.map'])
.pipe(uploadToSentry(opts, projects, release));
.pipe(uploadToSentry(opts, projects, release));
});
......@@ -58,9 +58,9 @@ function Adder(container, options) {
var enterTimeout;
element.querySelector('.js-annotate-btn')
.addEventListener('click', handleCommand.bind(this, 'annotate'));
.addEventListener('click', handleCommand.bind(this, 'annotate'));
element.querySelector('.js-highlight-btn')
.addEventListener('click', handleCommand.bind(this, 'highlight'));
.addEventListener('click', handleCommand.bind(this, 'highlight'));
function handleCommand(command, event) {
event.preventDefault();
......
......@@ -30,14 +30,14 @@ function selections(document) {
var isMouseDown;
var selectionEvents = observable.listen(document,
['mousedown', 'mouseup', 'selectionchange'])
.filter(function (event) {
if (event.type === 'mousedown' || event.type === 'mouseup') {
isMouseDown = event.type === 'mousedown';
return false;
} else {
return !isMouseDown;
}
});
.filter(function (event) {
if (event.type === 'mousedown' || event.type === 'mouseup') {
isMouseDown = event.type === 'mousedown';
return false;
} else {
return !isMouseDown;
}
});
var events = observable.merge([
// Add a delay before checking the state of the selection because
......
......@@ -17,7 +17,7 @@ describe('h:session', function () {
before(function () {
angular.module('h', ['ngResource'])
.service('session', require('../session'));
.service('session', require('../session'));
});
beforeEach(mock.module('h'));
......
......@@ -12,14 +12,14 @@ describe('store', function () {
before(function () {
angular.module('h')
.service('store', proxyquire('../store', util.noCallThru({
angular: angular,
'./retry-util': {
retryPromiseOperation: function (fn) {
return fn();
.service('store', proxyquire('../store', util.noCallThru({
angular: angular,
'./retry-util': {
retryPromiseOperation: function (fn) {
return fn();
},
},
},
})));
})));
});
beforeEach(angular.mock.module('h'));
......@@ -70,27 +70,27 @@ describe('store', function () {
assert.isNotNull(saved.id);
});
$httpBackend.expectPOST('http://example.com/api/annotations')
.respond(function () {
return [201, {id: 'new-id'}, {}];
});
.respond(function () {
return [201, {id: 'new-id'}, {}];
});
$httpBackend.flush();
});
it('updates an annotation', function () {
store.annotation.update({id: 'an-id'}, {text: 'updated'});
$httpBackend.expectPUT('http://example.com/api/annotations/an-id')
.respond(function () {
return [200, {}, {}];
});
.respond(function () {
return [200, {}, {}];
});
$httpBackend.flush();
});
it('deletes an annotation', function () {
store.annotation.delete({id: 'an-id'}, {});
$httpBackend.expectDELETE('http://example.com/api/annotations/an-id')
.respond(function () {
return [200, {}, {}];
});
.respond(function () {
return [200, {}, {}];
});
$httpBackend.flush();
});
......@@ -104,7 +104,7 @@ describe('store', function () {
$httpBackend.expectPOST('http://example.com/api/annotations', {
allowed: 123,
})
.respond(function () { return {id: 'test'}; });
.respond(function () { return {id: 'test'}; });
$httpBackend.flush();
});
......@@ -113,7 +113,7 @@ describe('store', function () {
it('encodes semicolons in query parameters', function () {
store.search({'uri': 'http://example.com/?foo=bar;baz=qux'});
$httpBackend.expectGET('http://example.com/api/search?uri=http%3A%2F%2Fexample.com%2F%3Ffoo%3Dbar%3Bbaz%3Dqux')
.respond(function () { return [200, {}, {}]; });
.respond(function () { return [200, {}, {}]; });
$httpBackend.flush();
});
});
......@@ -38,6 +38,7 @@
"escape-html": "^1.0.3",
"escape-string-regexp": "^1.0.5",
"eslint": "^3.0.1",
"eslint-config-hypothesis": "^1.0.0",
"exorcist": "^0.4.0",
"extend": "^2.0.0",
"gulp": "^3.9.1",
......
......@@ -146,11 +146,11 @@ function reformat(js) {
}).then(result => {
return result.dest;
})
.then(result => {
var checker = new Checker();
checker.configure(jscsConfig);
return checker.fixString(result).output;
});
.then(result => {
var checker = new Checker();
checker.configure(jscsConfig);
return checker.fixString(result).output;
});
}
function toResultOrError(promise) {
......
......@@ -174,7 +174,7 @@ module.exports = function createBundle(config, buildOpts) {
log('Build error', err.toString());
});
var stream = b.pipe(exorcist(sourcemapPath))
.pipe(output);
.pipe(output);
return streamFinished(stream);
}
......
......@@ -106,20 +106,20 @@ module.exports = function uploadToSentry(opts, projects, release) {
return through.obj(function (file, enc, callback) {
Promise.all(releases)
.then(function () {
gulpUtil.log(`Uploading ${path.basename(file.path)}`);
var uploads = projects.map(function (project) {
return uploadReleaseFile(opts, project, release, file);
});
.then(function () {
gulpUtil.log(`Uploading ${path.basename(file.path)}`);
var uploads = projects.map(function (project) {
return uploadReleaseFile(opts, project, release, file);
});
return Promise.all(uploads);
})
.then(function () {
callback();
})
.catch(function (err) {
gulpUtil.log('Sentry upload failed: ', err);
callback(err);
});
return Promise.all(uploads);
})
.then(function () {
callback();
})
.catch(function (err) {
gulpUtil.log('Sentry upload failed: ', err);
callback(err);
});
});
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment