Unverified Commit 8dab397a authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #871 from hypothesis/dependabot/npm_and_yarn/eslint-4.19.1

Bump eslint from 3.19.0 to 4.19.1
parents 555d6330 5099470d
...@@ -372,7 +372,7 @@ function runKarma(baseConfig, opts, done) { ...@@ -372,7 +372,7 @@ function runKarma(baseConfig, opts, done) {
const BaseReporter = require('karma/lib/reporters/base'); const BaseReporter = require('karma/lib/reporters/base');
BaseReporter.decoratorFactory.$inject = BaseReporter.decoratorFactory.$inject =
BaseReporter.decoratorFactory.$inject.map(dep => BaseReporter.decoratorFactory.$inject.map(dep =>
dep.replace('browserLogOptions', 'browserConsoleLogOptions')); dep.replace('browserLogOptions', 'browserConsoleLogOptions'));
const karma = require('karma'); const karma = require('karma');
new karma.Server(Object.assign({}, { new karma.Server(Object.assign({}, {
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
"end-of-stream": "^1.1.0", "end-of-stream": "^1.1.0",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"escape-string-regexp": "^1.0.5", "escape-string-regexp": "^1.0.5",
"eslint": "^3.18.0", "eslint": "^4.19.1",
"eslint-config-hypothesis": "^1.0.0", "eslint-config-hypothesis": "^1.0.0",
"eslint-plugin-mocha": "^4.8.0", "eslint-plugin-mocha": "^4.8.0",
"exorcist": "^0.4.0", "exorcist": "^0.4.0",
......
...@@ -116,7 +116,7 @@ function checkSyntax(js) { ...@@ -116,7 +116,7 @@ function checkSyntax(js) {
} }
}, []).join('\n'); }, []).join('\n');
throw new Error( throw new Error(
`Could not parsing ES2015 JavaScript generated by 'decaffeinate'. `Could not parsing ES2015 JavaScript generated by 'decaffeinate'.
You may need to fix or simplify the CoffeeScript first. You may need to fix or simplify the CoffeeScript first.
Error: ${err} Error: ${err}
......
...@@ -200,7 +200,7 @@ module.exports = function createBundle(config, buildOpts) { ...@@ -200,7 +200,7 @@ module.exports = function createBundle(config, buildOpts) {
// the root of the repository // the root of the repository
const repoRootPath = path.join(__dirname, '../../'); const repoRootPath = path.join(__dirname, '../../');
const relativePath = path.relative(path.resolve(repoRootPath), const relativePath = path.relative(path.resolve(repoRootPath),
path.resolve(req)); path.resolve(req));
bundle.require(req, {expose: '/' + relativePath}); bundle.require(req, {expose: '/' + relativePath});
} else { } else {
// this is a package under node_modules/, no // this is a package under node_modules/, no
......
...@@ -42,8 +42,8 @@ const config = configFrom(window); ...@@ -42,8 +42,8 @@ const config = configFrom(window);
$.noConflict(true)(function() { $.noConflict(true)(function() {
let Klass = window.PDFViewerApplication ? let Klass = window.PDFViewerApplication ?
PdfSidebar : PdfSidebar :
Sidebar; Sidebar;
if (config.hasOwnProperty('constructor')) { if (config.hasOwnProperty('constructor')) {
Klass = config.constructor; Klass = config.constructor;
......
...@@ -229,7 +229,7 @@ describe('DocumentMeta', function() { ...@@ -229,7 +229,7 @@ describe('DocumentMeta', function() {
const expected = ( const expected = (
document.location.protocol + '//' + document.location.protocol + '//' +
document.location.host + document.location.host +
document.location.pathname.replace(/[^\/]+$/, '') + document.location.pathname.replace(/[^/]+$/, '') +
'path' 'path'
); );
assert.equal(result, expected); assert.equal(result, expected);
......
...@@ -155,7 +155,7 @@ describe('annotator/plugin/pdf-metadata', function () { ...@@ -155,7 +155,7 @@ describe('annotator/plugin/pdf-metadata', function () {
return pdfMetadata.getUri().then(uri => { return pdfMetadata.getUri().then(uri => {
const expected = new URL(fakePDFViewerApplication.url, const expected = new URL(fakePDFViewerApplication.url,
document.location.href).toString(); document.location.href).toString();
assert.equal(uri, expected); assert.equal(uri, expected);
}); });
}); });
...@@ -166,7 +166,7 @@ describe('annotator/plugin/pdf-metadata', function () { ...@@ -166,7 +166,7 @@ describe('annotator/plugin/pdf-metadata', function () {
const expectedMetadata = { const expectedMetadata = {
title: 'dcFakeTitle', title: 'dcFakeTitle',
link: [{href: 'urn:x-pdf:' + fakePDFViewerApplication.pdfDocument.fingerprint}, link: [{href: 'urn:x-pdf:' + fakePDFViewerApplication.pdfDocument.fingerprint},
{href: fakePDFViewerApplication.url}], {href: fakePDFViewerApplication.url}],
documentFingerprint: fakePDFViewerApplication.pdfDocument.fingerprint, documentFingerprint: fakePDFViewerApplication.pdfDocument.fingerprint,
}; };
...@@ -179,7 +179,7 @@ describe('annotator/plugin/pdf-metadata', function () { ...@@ -179,7 +179,7 @@ describe('annotator/plugin/pdf-metadata', function () {
const expectedMetadata = { const expectedMetadata = {
title: fakePDFViewerApplication.documentInfo.Title, title: fakePDFViewerApplication.documentInfo.Title,
link: [{href: 'urn:x-pdf:' + fakePDFViewerApplication.pdfDocument.fingerprint}, link: [{href: 'urn:x-pdf:' + fakePDFViewerApplication.pdfDocument.fingerprint},
{href: fakePDFViewerApplication.url}], {href: fakePDFViewerApplication.url}],
documentFingerprint: fakePDFViewerApplication.pdfDocument.fingerprint, documentFingerprint: fakePDFViewerApplication.pdfDocument.fingerprint,
}; };
......
...@@ -83,7 +83,7 @@ describe('anchoring', function () { ...@@ -83,7 +83,7 @@ describe('anchoring', function () {
return Promise.all(anchored).then(function () { return Promise.all(anchored).then(function () {
const assertFn = testCase.expectFail ? assert.notDeepEqual : assert.deepEqual; const assertFn = testCase.expectFail ? assert.notDeepEqual : assert.deepEqual;
assertFn(normalize(highlightedPhrases(container)), assertFn(normalize(highlightedPhrases(container)),
normalize(testCase.quotes)); normalize(testCase.quotes));
}); });
}, [{ }, [{
tag: 'a simple quote', tag: 'a simple quote',
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
const Observable = require('zen-observable'); const Observable = require('zen-observable');
/** /**
* Returns an observable of events emitted by a DOM event source * Returns an observable of events emitted by a DOM event source
* (eg. an Element, Document or Window). * (eg. an Element, Document or Window).
* *
...@@ -54,7 +54,7 @@ function delay(delay, src) { ...@@ -54,7 +54,7 @@ function delay(delay, src) {
}); });
} }
/** /**
* Buffers events from a source Observable, waiting for a pause of `delay` * Buffers events from a source Observable, waiting for a pause of `delay`
* ms with no events before emitting the last value from `src`. * ms with no events before emitting the last value from `src`.
* *
...@@ -86,7 +86,7 @@ function buffer(delay, src) { ...@@ -86,7 +86,7 @@ function buffer(delay, src) {
}); });
} }
/** /**
* Merges multiple streams of values into a single stream. * Merges multiple streams of values into a single stream.
* *
* @param {Array<Observable>} sources * @param {Array<Observable>} sources
......
...@@ -189,7 +189,7 @@ class Discovery { ...@@ -189,7 +189,7 @@ class Discovery {
discovered = true; discovered = true;
} else if (messageType === 'offer' || messageType === 'ack') { } else if (messageType === 'offer' || messageType === 'ack') {
throw new Error( throw new Error(
`A second Discovery server has been detected at ${origin}. `A second Discovery server has been detected at ${origin}.
This is unsupported and will cause unexpected behaviour.` This is unsupported and will cause unexpected behaviour.`
); );
} }
......
...@@ -134,7 +134,7 @@ function AnnotationController( ...@@ -134,7 +134,7 @@ function AnnotationController(
self.annotation.group = self.annotation.group || groups.focused().id; self.annotation.group = self.annotation.group || groups.focused().id;
if (!self.annotation.permissions) { if (!self.annotation.permissions) {
self.annotation.permissions = permissions.default(self.annotation.user, self.annotation.permissions = permissions.default(self.annotation.user,
self.annotation.group); self.annotation.group);
} }
self.annotation.text = self.annotation.text || ''; self.annotation.text = self.annotation.text || '';
if (!Array.isArray(self.annotation.tags)) { if (!Array.isArray(self.annotation.tags)) {
...@@ -555,7 +555,7 @@ function AnnotationController( ...@@ -555,7 +555,7 @@ function AnnotationController(
tags: self.annotation.tags, tags: self.annotation.tags,
text: self.annotation.text, text: self.annotation.text,
isPrivate: !permissions.isShared(self.annotation.permissions, isPrivate: !permissions.isShared(self.annotation.permissions,
self.annotation.user), self.annotation.user),
}; };
}; };
......
...@@ -68,7 +68,7 @@ function MarkdownController($element, $sanitize, $scope) { ...@@ -68,7 +68,7 @@ function MarkdownController($element, $sanitize, $scope) {
return commands.toggleSpanStyle(state, '$$', '$$', 'Insert LaTeX'); return commands.toggleSpanStyle(state, '$$', '$$', 'Insert LaTeX');
} else { } else {
return commands.toggleSpanStyle(state, '\\(', '\\)', return commands.toggleSpanStyle(state, '\\(', '\\)',
'Insert LaTeX'); 'Insert LaTeX');
} }
}); });
}; };
......
...@@ -258,7 +258,7 @@ describe('annotation', function() { ...@@ -258,7 +258,7 @@ describe('annotation', function() {
beforeEach( beforeEach(
inject( inject(
function(_$q_, _$rootScope_, _$timeout_, function(_$q_, _$rootScope_, _$timeout_,
_$window_) { _$window_) {
$window = _$window_; $window = _$window_;
$q = _$q_; $q = _$q_;
$timeout = _$timeout_; $timeout = _$timeout_;
...@@ -311,7 +311,7 @@ describe('annotation', function() { ...@@ -311,7 +311,7 @@ describe('annotation', function() {
createDirective(annotation); createDirective(annotation);
assert.deepEqual(annotation.permissions, fakePermissions.default( assert.deepEqual(annotation.permissions, fakePermissions.default(
fakeSession.state.userid, annotation.group)); fakeSession.state.userid, annotation.group));
}); });
it('sets the tags and text fields for new annotations', function () { it('sets the tags and text fields for new annotations', function () {
...@@ -691,7 +691,7 @@ describe('annotation', function() { ...@@ -691,7 +691,7 @@ describe('annotation', function() {
fakeAnnotationMapper.deleteAnnotation.returns($q.resolve()); fakeAnnotationMapper.deleteAnnotation.returns($q.resolve());
parts.controller.delete().then(function() { parts.controller.delete().then(function() {
assert.calledWith(fakeAnnotationMapper.deleteAnnotation, assert.calledWith(fakeAnnotationMapper.deleteAnnotation,
parts.annotation); parts.annotation);
done(); done();
}); });
$timeout.flush(); $timeout.flush();
...@@ -773,7 +773,7 @@ describe('annotation', function() { ...@@ -773,7 +773,7 @@ describe('annotation', function() {
fakeAnnotationMapper.flagAnnotation.returns($q.resolve()); fakeAnnotationMapper.flagAnnotation.returns($q.resolve());
parts.controller.flag(); parts.controller.flag();
assert.calledWith(fakeAnnotationMapper.flagAnnotation, assert.calledWith(fakeAnnotationMapper.flagAnnotation,
parts.annotation); parts.annotation);
done(); done();
} }
); );
...@@ -920,7 +920,7 @@ describe('annotation', function() { ...@@ -920,7 +920,7 @@ describe('annotation', function() {
['update', 'delete'].forEach(function (action) { ['update', 'delete'].forEach(function (action) {
controller.authorize(action); controller.authorize(action);
assert.calledWith(fakePermissions.permits, ann.permissions, action, assert.calledWith(fakePermissions.permits, ann.permissions, action,
fakeSession.state.userid); fakeSession.state.userid);
}); });
}); });
}); });
......
...@@ -10,7 +10,7 @@ function pageObject(element) { ...@@ -10,7 +10,7 @@ function pageObject(element) {
return { return {
menuLinks: function () { menuLinks: function () {
return Array.from(element[0].querySelectorAll('.login-control-menu .dropdown-menu a')) return Array.from(element[0].querySelectorAll('.login-control-menu .dropdown-menu a'))
.map(function (el) { return el.textContent; }); .map(function (el) { return el.textContent; });
}, },
menuText: function () { menuText: function () {
return element[0].querySelector('span').textContent; return element[0].querySelector('span').textContent;
......
...@@ -71,8 +71,8 @@ describe('BrandingDirective', function () { ...@@ -71,8 +71,8 @@ describe('BrandingDirective', function () {
const el = makeElementWithAttrs(testCase.attrs); const el = makeElementWithAttrs(testCase.attrs);
if(Array.isArray(testCase.styleChanged)){ if(Array.isArray(testCase.styleChanged)){
// we expect that if styleChanged is an array // we expect that if styleChanged is an array
// that expectedPropValue will be an equal length array // that expectedPropValue will be an equal length array
testCase.styleChanged.forEach(function(styleChanged, index){ testCase.styleChanged.forEach(function(styleChanged, index){
assert.equal(el[0].style[styleChanged], testCase.expectedPropValue[index]); assert.equal(el[0].style[styleChanged], testCase.expectedPropValue[index]);
}); });
......
...@@ -120,92 +120,92 @@ function startAngularApp(config) { ...@@ -120,92 +120,92 @@ function startAngularApp(config) {
]) ])
// The root component for the application // The root component for the application
.component('hypothesisApp', require('./components/hypothesis-app')) .component('hypothesisApp', require('./components/hypothesis-app'))
// UI components // UI components
.component('annotation', require('./components/annotation')) .component('annotation', require('./components/annotation'))
.component('annotationHeader', require('./components/annotation-header')) .component('annotationHeader', require('./components/annotation-header'))
.component('annotationActionButton', require('./components/annotation-action-button')) .component('annotationActionButton', require('./components/annotation-action-button'))
.component('annotationShareDialog', require('./components/annotation-share-dialog')) .component('annotationShareDialog', require('./components/annotation-share-dialog'))
.component('annotationThread', require('./components/annotation-thread')) .component('annotationThread', require('./components/annotation-thread'))
.component('annotationViewerContent', require('./components/annotation-viewer-content')) .component('annotationViewerContent', require('./components/annotation-viewer-content'))
.component('dropdownMenuBtn', require('./components/dropdown-menu-btn')) .component('dropdownMenuBtn', require('./components/dropdown-menu-btn'))
.component('excerpt', require('./components/excerpt')) .component('excerpt', require('./components/excerpt'))
.component('groupList', require('./components/group-list')) .component('groupList', require('./components/group-list'))
.component('helpLink', require('./components/help-link')) .component('helpLink', require('./components/help-link'))
.component('helpPanel', require('./components/help-panel')) .component('helpPanel', require('./components/help-panel'))
.component('loggedoutMessage', require('./components/loggedout-message')) .component('loggedoutMessage', require('./components/loggedout-message'))
.component('loginControl', require('./components/login-control')) .component('loginControl', require('./components/login-control'))
.component('markdown', require('./components/markdown')) .component('markdown', require('./components/markdown'))
.component('moderationBanner', require('./components/moderation-banner')) .component('moderationBanner', require('./components/moderation-banner'))
.component('newNoteBtn', require('./components/new-note-btn')) .component('newNoteBtn', require('./components/new-note-btn'))
.component('publishAnnotationBtn', require('./components/publish-annotation-btn')) .component('publishAnnotationBtn', require('./components/publish-annotation-btn'))
.component('searchInput', require('./components/search-input')) .component('searchInput', require('./components/search-input'))
.component('searchStatusBar', require('./components/search-status-bar')) .component('searchStatusBar', require('./components/search-status-bar'))
.component('selectionTabs', require('./components/selection-tabs')) .component('selectionTabs', require('./components/selection-tabs'))
.component('sidebarContent', require('./components/sidebar-content')) .component('sidebarContent', require('./components/sidebar-content'))
.component('sidebarTutorial', require('./components/sidebar-tutorial')) .component('sidebarTutorial', require('./components/sidebar-tutorial'))
.component('shareDialog', require('./components/share-dialog')) .component('shareDialog', require('./components/share-dialog'))
.component('sortDropdown', require('./components/sort-dropdown')) .component('sortDropdown', require('./components/sort-dropdown'))
.component('spinner', require('./components/spinner')) .component('spinner', require('./components/spinner'))
.component('streamContent', require('./components/stream-content')) .component('streamContent', require('./components/stream-content'))
.component('svgIcon', require('./components/svg-icon')) .component('svgIcon', require('./components/svg-icon'))
.component('tagEditor', require('./components/tag-editor')) .component('tagEditor', require('./components/tag-editor'))
.component('threadList', require('./components/thread-list')) .component('threadList', require('./components/thread-list'))
.component('timestamp', require('./components/timestamp')) .component('timestamp', require('./components/timestamp'))
.component('topBar', require('./components/top-bar')) .component('topBar', require('./components/top-bar'))
.directive('hAutofocus', require('./directive/h-autofocus')) .directive('hAutofocus', require('./directive/h-autofocus'))
.directive('hBranding', require('./directive/h-branding')) .directive('hBranding', require('./directive/h-branding'))
.directive('hOnTouch', require('./directive/h-on-touch')) .directive('hOnTouch', require('./directive/h-on-touch'))
.directive('hTooltip', require('./directive/h-tooltip')) .directive('hTooltip', require('./directive/h-tooltip'))
.directive('windowScroll', require('./directive/window-scroll')) .directive('windowScroll', require('./directive/window-scroll'))
.service('analytics', require('./services/analytics')) .service('analytics', require('./services/analytics'))
.service('annotationMapper', require('./services/annotation-mapper')) .service('annotationMapper', require('./services/annotation-mapper'))
.service('api', require('./services/api')) .service('api', require('./services/api'))
.service('apiRoutes', require('./services/api-routes')) .service('apiRoutes', require('./services/api-routes'))
.service('auth', require('./services/oauth-auth')) .service('auth', require('./services/oauth-auth'))
.service('bridge', require('../shared/bridge')) .service('bridge', require('../shared/bridge'))
.service('drafts', require('./services/drafts')) .service('drafts', require('./services/drafts'))
.service('features', require('./services/features')) .service('features', require('./services/features'))
.service('flash', require('./services/flash')) .service('flash', require('./services/flash'))
.service('frameSync', require('./services/frame-sync').default) .service('frameSync', require('./services/frame-sync').default)
.service('groups', require('./services/groups')) .service('groups', require('./services/groups'))
.service('localStorage', require('./services/local-storage')) .service('localStorage', require('./services/local-storage'))
.service('permissions', require('./services/permissions')) .service('permissions', require('./services/permissions'))
.service('rootThread', require('./services/root-thread')) .service('rootThread', require('./services/root-thread'))
.service('searchFilter', require('./services/search-filter')) .service('searchFilter', require('./services/search-filter'))
.service('serviceUrl', require('./services/service-url')) .service('serviceUrl', require('./services/service-url'))
.service('session', require('./services/session')) .service('session', require('./services/session'))
.service('streamer', require('./services/streamer')) .service('streamer', require('./services/streamer'))
.service('streamFilter', require('./services/stream-filter')) .service('streamFilter', require('./services/stream-filter'))
.service('tags', require('./services/tags')) .service('tags', require('./services/tags'))
.service('unicode', require('./services/unicode')) .service('unicode', require('./services/unicode'))
.service('viewFilter', require('./services/view-filter')) .service('viewFilter', require('./services/view-filter'))
// Redux store // Redux store
.service('store', require('./store')) .service('store', require('./store'))
// Utilities // Utilities
.value('Discovery', require('../shared/discovery')) .value('Discovery', require('../shared/discovery'))
.value('ExcerptOverflowMonitor', require('./util/excerpt-overflow-monitor')) .value('ExcerptOverflowMonitor', require('./util/excerpt-overflow-monitor'))
.value('OAuthClient', require('./util/oauth-client')) .value('OAuthClient', require('./util/oauth-client'))
.value('VirtualThreadList', require('./virtual-thread-list')) .value('VirtualThreadList', require('./virtual-thread-list'))
.value('isSidebar', isSidebar) .value('isSidebar', isSidebar)
.value('random', require('./util/random')) .value('random', require('./util/random'))
.value('raven', require('./raven')) .value('raven', require('./raven'))
.value('serviceConfig', serviceConfig) .value('serviceConfig', serviceConfig)
.value('settings', config) .value('settings', config)
.value('time', require('./util/time')) .value('time', require('./util/time'))
.value('urlEncodeFilter', require('./filter/url').encode) .value('urlEncodeFilter', require('./filter/url').encode)
.config(configureLocation) .config(configureLocation)
.config(configureRoutes) .config(configureRoutes)
.config(configureToastr) .config(configureToastr)
.run(setupHttp) .run(setupHttp)
.run(crossOriginRPC.server.start); .run(crossOriginRPC.server.start);
if (config.liveReloadServer) { if (config.liveReloadServer) {
require('./live-reload-client').connect(config.liveReloadServer); require('./live-reload-client').connect(config.liveReloadServer);
......
...@@ -153,7 +153,7 @@ function toggleSpanStyle(state, prefix, suffix, placeholder) { ...@@ -153,7 +153,7 @@ function toggleSpanStyle(state, prefix, suffix, placeholder) {
if (selectionPrefix === prefix && selectionSuffix === suffix) { if (selectionPrefix === prefix && selectionSuffix === suffix) {
newState = replaceText(newState, newState.selectionStart - prefix.length, newState = replaceText(newState, newState.selectionStart - prefix.length,
prefix.length, ''); prefix.length, '');
newState = replaceText(newState, newState.selectionEnd, suffix.length, ''); newState = replaceText(newState, newState.selectionEnd, suffix.length, '');
} else { } else {
newState = replaceText(newState, newState.selectionStart, 0, prefix); newState = replaceText(newState, newState.selectionStart, 0, prefix);
......
...@@ -134,7 +134,7 @@ const embedGenerators = [ ...@@ -134,7 +134,7 @@ const embedGenerators = [
return null; return null;
} }
const groups = /[&\?]v=([^&#]+)/.exec(link.search); const groups = /[&?]v=([^&#]+)/.exec(link.search);
if (groups) { if (groups) {
return youTubeEmbed(groups[1], link); return youTubeEmbed(groups[1], link);
} }
...@@ -148,7 +148,7 @@ const embedGenerators = [ ...@@ -148,7 +148,7 @@ const embedGenerators = [
} }
// extract video ID from URL // extract video ID from URL
const groups = /^\/([^\/]+)\/?$/.exec(link.pathname); const groups = /^\/([^/]+)\/?$/.exec(link.pathname);
if (groups) { if (groups) {
return youTubeEmbed(groups[1], link); return youTubeEmbed(groups[1], link);
} }
...@@ -161,7 +161,7 @@ const embedGenerators = [ ...@@ -161,7 +161,7 @@ const embedGenerators = [
return null; return null;
} }
const groups = /^\/([^\/\?#]+)\/?$/.exec(link.pathname); const groups = /^\/([^/?#]+)\/?$/.exec(link.pathname);
if (groups) { if (groups) {
return vimeoEmbed(groups[1]); return vimeoEmbed(groups[1]);
} }
...@@ -174,7 +174,7 @@ const embedGenerators = [ ...@@ -174,7 +174,7 @@ const embedGenerators = [
return null; return null;
} }
const groups = /^\/channels\/[^\/]+\/([^\/?#]+)\/?$/.exec(link.pathname); const groups = /^\/channels\/[^/]+\/([^/?#]+)\/?$/.exec(link.pathname);
if (groups) { if (groups) {
return vimeoEmbed(groups[1]); return vimeoEmbed(groups[1]);
} }
...@@ -219,7 +219,7 @@ const embedGenerators = [ ...@@ -219,7 +219,7 @@ const embedGenerators = [
let endTime = linkParams.end; let endTime = linkParams.end;
if (!startTime) { if (!startTime) {
const startPathParam = slug.match(/\/start\/([^\/]+)/); const startPathParam = slug.match(/\/start\/([^/]+)/);
if (startPathParam) { if (startPathParam) {
startTime = startPathParam[1]; startTime = startPathParam[1];
slug = slug.replace(startPathParam[0], ''); slug = slug.replace(startPathParam[0], '');
...@@ -227,7 +227,7 @@ const embedGenerators = [ ...@@ -227,7 +227,7 @@ const embedGenerators = [
} }
if (!endTime) { if (!endTime) {
const endPathParam = slug.match(/\/end\/([^\/]+)/); const endPathParam = slug.match(/\/end\/([^/]+)/);
if (endPathParam) { if (endPathParam) {
endTime = endPathParam[1]; endTime = endPathParam[1];
slug = slug.replace(endPathParam[0], ''); slug = slug.replace(endPathParam[0], '');
......
...@@ -16,7 +16,7 @@ const uiConstants = require('../ui-constants'); ...@@ -16,7 +16,7 @@ const uiConstants = require('../ui-constants');
* for PDFs * for PDFs
*/ */
/** /**
* Return a minimal representation of an annotation that can be sent from the * Return a minimal representation of an annotation that can be sent from the
* sidebar app to a connected frame. * sidebar app to a connected frame.
* *
......
...@@ -17,7 +17,7 @@ const serviceConfig = require('../service-config'); ...@@ -17,7 +17,7 @@ const serviceConfig = require('../service-config');
// @ngInject // @ngInject
function groups($rootScope, store, api, isSidebar, localStorage, serviceUrl, session, function groups($rootScope, store, api, isSidebar, localStorage, serviceUrl, session,
settings) { settings) {
const svc = serviceConfig(settings); const svc = serviceConfig(settings);
const authority = svc ? svc.authority : null; const authority = svc ? svc.authority : null;
......
...@@ -25,7 +25,7 @@ const serviceConfig = require('../service-config'); ...@@ -25,7 +25,7 @@ const serviceConfig = require('../service-config');
*/ */
// @ngInject // @ngInject
function auth($http, $rootScope, $window, OAuthClient, function auth($http, $rootScope, $window, OAuthClient,
apiRoutes, flash, localStorage, settings) { apiRoutes, flash, localStorage, settings) {
/** /**
* Authorization code from auth popup window. * Authorization code from auth popup window.
......
...@@ -21,7 +21,7 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes ...@@ -21,7 +21,7 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
* @ngInject * @ngInject
*/ */
function session($q, $rootScope, analytics, store, api, auth, function session($q, $rootScope, analytics, store, api, auth,
flash, raven, settings, serviceConfig) { flash, raven, settings, serviceConfig) {
// Cache the result of load() // Cache the result of load()
let lastLoad; let lastLoad;
let lastLoadTime; let lastLoadTime;
......
...@@ -21,7 +21,7 @@ const Socket = require('../websocket'); ...@@ -21,7 +21,7 @@ const Socket = require('../websocket');
*/ */
// @ngInject // @ngInject
function Streamer($rootScope, annotationMapper, store, auth, function Streamer($rootScope, annotationMapper, store, auth,
groups, session, settings) { groups, session, settings) {
// The randomly generated session UUID // The randomly generated session UUID
const clientId = uuid.v4(); const clientId = uuid.v4();
......
...@@ -216,9 +216,9 @@ describe('sidebar.services.api', function () { ...@@ -216,9 +216,9 @@ describe('sidebar.services.api', function () {
done(); done();
}); });
$httpBackend.expectPATCH('https://example.com/api/profile') $httpBackend.expectPATCH('https://example.com/api/profile')
.respond(function () { .respond(function () {
return [testCase.status, testCase.body, {}, testCase.statusText]; return [testCase.status, testCase.body, {}, testCase.statusText];
}); });
$httpBackend.flush(); $httpBackend.flush();
}, [{ }, [{
// Network error // Network error
...@@ -253,9 +253,9 @@ describe('sidebar.services.api', function () { ...@@ -253,9 +253,9 @@ describe('sidebar.services.api', function () {
done(); done();
}); });
$httpBackend.expectPATCH('https://example.com/api/profile') $httpBackend.expectPATCH('https://example.com/api/profile')
.respond(function () { .respond(function () {
return [404, { reason: 'User not found' }, {}, 'Not found']; return [404, { reason: 'User not found' }, {}, 'Not found'];
}); });
$httpBackend.flush(); $httpBackend.flush();
}); });
}); });
...@@ -268,7 +268,7 @@ describe('sidebar.services.api', function () { ...@@ -268,7 +268,7 @@ describe('sidebar.services.api', function () {
}); });
$httpBackend.expectGET('https://example.com/api/profile') $httpBackend.expectGET('https://example.com/api/profile')
.respond(() => [200, { userid: 'acct:user@example.com' }]); .respond(() => [200, { userid: 'acct:user@example.com' }]);
$httpBackend.flush(); $httpBackend.flush();
}); });
...@@ -283,7 +283,7 @@ describe('sidebar.services.api', function () { ...@@ -283,7 +283,7 @@ describe('sidebar.services.api', function () {
}); });
$httpBackend.expectGET('https://example.com/api/profile') $httpBackend.expectGET('https://example.com/api/profile')
.respond(() => [200, { userid: 'acct:user@example.com' }]); .respond(() => [200, { userid: 'acct:user@example.com' }]);
$httpBackend.flush(); $httpBackend.flush();
}); });
}); });
...@@ -211,8 +211,8 @@ describe('groups', function() { ...@@ -211,8 +211,8 @@ describe('groups', function() {
{ id: '39r39f', name: 'Ding Dong!' }, { id: '39r39f', name: 'Ding Dong!' },
]; ];
fakeApi.groups.list.returns(Promise.resolve({ fakeApi.groups.list.returns(Promise.resolve({
token: '1234', token: '1234',
data: groups, data: groups,
})); }));
return svc.load().then(groups => { return svc.load().then(groups => {
assert.isObject(groups[0].organization); assert.isObject(groups[0].organization);
......
...@@ -39,19 +39,19 @@ describe('permissions', function () { ...@@ -39,19 +39,19 @@ describe('permissions', function () {
describe('#default', function () { describe('#default', function () {
it('returns shared permissions by default', function () { it('returns shared permissions by default', function () {
assert.deepEqual(permissions.default(userid, 'gid'), assert.deepEqual(permissions.default(userid, 'gid'),
permissions.shared(userid, 'gid')); permissions.shared(userid, 'gid'));
}); });
it('returns private permissions if the saved level is "private"', function () { it('returns private permissions if the saved level is "private"', function () {
fakeLocalStorage.getItem.returns('private'); fakeLocalStorage.getItem.returns('private');
assert.deepEqual(permissions.default(userid, 'gid'), assert.deepEqual(permissions.default(userid, 'gid'),
permissions.private(userid)); permissions.private(userid));
}); });
it('returns shared permissions if the saved level is "shared"', function () { it('returns shared permissions if the saved level is "shared"', function () {
fakeLocalStorage.getItem.returns('shared'); fakeLocalStorage.getItem.returns('shared');
assert.deepEqual(permissions.default(userid, 'gid'), assert.deepEqual(permissions.default(userid, 'gid'),
permissions.shared(userid, 'gid')); permissions.shared(userid, 'gid'));
}); });
}); });
......
...@@ -25,7 +25,7 @@ describe('sidebar.tags', () => { ...@@ -25,7 +25,7 @@ describe('sidebar.tags', () => {
before(() => { before(() => {
angular.module('h', []) angular.module('h', [])
.service('tags', require('../tags')); .service('tags', require('../tags'));
}); });
beforeEach(() => { beforeEach(() => {
......
...@@ -151,19 +151,19 @@ function viewFilter(unicode) { ...@@ -151,19 +151,19 @@ function viewFilter(unicode) {
// filters. // filters.
const fieldFilters = Object.entries(filters).filter(([, filter]) => const fieldFilters = Object.entries(filters).filter(([, filter]) =>
filter.terms.length > 0) filter.terms.length > 0)
.map(([field, filter]) => { .map(([field, filter]) => {
const terms = filter.terms.map(normalize); const terms = filter.terms.map(normalize);
let termFilters; let termFilters;
if (field === 'any') { if (field === 'any') {
const anyFields = ['quote', 'text', 'tag', 'user']; const anyFields = ['quote', 'text', 'tag', 'user'];
termFilters = terms.map(term => new BinaryOpFilter('or', anyFields.map(field => termFilters = terms.map(term => new BinaryOpFilter('or', anyFields.map(field =>
new TermFilter(field, term, fieldMatchers[field]) new TermFilter(field, term, fieldMatchers[field])
))); )));
} else { } else {
termFilters = terms.map(term => new TermFilter(field, term, fieldMatchers[field])); termFilters = terms.map(term => new TermFilter(field, term, fieldMatchers[field]));
} }
return new BinaryOpFilter(filter.operator, termFilters); return new BinaryOpFilter(filter.operator, termFilters);
}); });
const rootFilter = new BinaryOpFilter('and', fieldFilters); const rootFilter = new BinaryOpFilter('and', fieldFilters);
......
...@@ -262,13 +262,13 @@ function addAnnotations(annotations, now) { ...@@ -262,13 +262,13 @@ function addAnnotations(annotations, now) {
const ANCHORING_TIMEOUT = 500; const ANCHORING_TIMEOUT = 500;
const anchoringIDs = added.filter(metadata.isWaitingToAnchor) const anchoringIDs = added.filter(metadata.isWaitingToAnchor)
.map(ann => ann.id); .map(ann => ann.id);
if (anchoringIDs.length > 0) { if (anchoringIDs.length > 0) {
setTimeout(() => { setTimeout(() => {
// Find annotations which haven't yet been anchored in the document. // Find annotations which haven't yet been anchored in the document.
const anns = getState().annotations; const anns = getState().annotations;
const annsStillAnchoring = anchoringIDs.map(id => findByID(anns, id)) const annsStillAnchoring = anchoringIDs.map(id => findByID(anns, id))
.filter(ann => ann && metadata.isWaitingToAnchor(ann)); .filter(ann => ann && metadata.isWaitingToAnchor(ann));
// Mark anchoring as timed-out for these annotations. // Mark anchoring as timed-out for these annotations.
const anchorStatusUpdates = annsStillAnchoring.reduce((updates, ann) => { const anchorStatusUpdates = annsStillAnchoring.reduce((updates, ann) => {
......
...@@ -24,7 +24,7 @@ const util = require('../util'); ...@@ -24,7 +24,7 @@ const util = require('../util');
*/ */
const TAB_DEFAULT = uiConstants.TAB_ANNOTATIONS; const TAB_DEFAULT = uiConstants.TAB_ANNOTATIONS;
/** /**
* Default sort keys for each tab. * Default sort keys for each tab.
*/ */
const TAB_SORTKEY_DEFAULT = {}; const TAB_SORTKEY_DEFAULT = {};
......
...@@ -61,13 +61,13 @@ describe('markdown commands', function () { ...@@ -61,13 +61,13 @@ describe('markdown commands', function () {
it('adds formatting to spans when the prefix and suffix differ', function () { it('adds formatting to spans when the prefix and suffix differ', function () {
const output = toggle(parseState('make <sel>math</sel> mathy'), '\\(', const output = toggle(parseState('make <sel>math</sel> mathy'), '\\(',
'\\)'); '\\)');
assert.equal(formatState(output), 'make \\(<sel>math</sel>\\) mathy'); assert.equal(formatState(output), 'make \\(<sel>math</sel>\\) mathy');
}); });
it('inserts placeholders if the selection is empty', function () { it('inserts placeholders if the selection is empty', function () {
const output = toggle(parseState('make <sel></sel> bold'), '**', const output = toggle(parseState('make <sel></sel> bold'), '**',
undefined, 'Bold'); undefined, 'Bold');
assert.equal(formatState(output), 'make **<sel>Bold</sel>** bold'); assert.equal(formatState(output), 'make **<sel>Bold</sel>** bold');
}); });
}); });
......
...@@ -360,7 +360,7 @@ describe('media-embedder', function () { ...@@ -360,7 +360,7 @@ describe('media-embedder', function () {
const url1 = 'https://www.youtube.com/watch?v=QCkm0lL-6lc'; const url1 = 'https://www.youtube.com/watch?v=QCkm0lL-6lc';
const url2 = 'https://youtu.be/abcdefg'; const url2 = 'https://youtu.be/abcdefg';
const element = domElement( const element = domElement(
'<a href="' + url1 + '">' + url1 + '</a>\n\n' + '<a href="' + url1 + '">' + url1 + '</a>\n\n' +
'<a href="' + url2 + '">' + url2 + '</a>'); '<a href="' + url2 + '">' + url2 + '</a>');
mediaEmbedder.replaceLinksWithEmbeds(element); mediaEmbedder.replaceLinksWithEmbeds(element);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
const immutable = require('seamless-immutable'); const immutable = require('seamless-immutable');
// TODO: Update when this is a property available on the API response // TODO: Update when this is a property available on the API response
const DEFAULT_ORG_ID = '__default__'; const DEFAULT_ORG_ID = '__default__';
/** /**
......
...@@ -29,7 +29,7 @@ function createTimeout(delay, message) { ...@@ -29,7 +29,7 @@ function createTimeout(delay, message) {
* @return {Promise<any>} - A Promise for the response to the call * @return {Promise<any>} - A Promise for the response to the call
*/ */
function call(frame, origin, method, params=[], timeout=2000, function call(frame, origin, method, params=[], timeout=2000,
window_=window, id=generateId()) { window_=window, id=generateId()) {
// Send RPC request. // Send RPC request.
const request = { const request = {
......
...@@ -81,7 +81,7 @@ function format(date, options, Intl) { ...@@ -81,7 +81,7 @@ function format(date, options, Intl) {
if (!formatter) { if (!formatter) {
formatter = formatters[key] = new Intl.DateTimeFormat(undefined, formatter = formatters[key] = new Intl.DateTimeFormat(undefined,
options); options);
} }
return formatter.format(date); return formatter.format(date);
......
This diff is collapsed.
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