Commit f6a57e1d authored by Robert Knight's avatar Robert Knight

Run eslint --fix

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