Commit cb455106 authored by Robert Knight's avatar Robert Knight

Fix remaining usages of "var" manually

Fix the uses which js-codemod's "no vars" transform was unable to change
automatically.
parent 15b11fce
...@@ -103,7 +103,7 @@ function isNew(annotation) { ...@@ -103,7 +103,7 @@ function isNew(annotation) {
/** Return `true` if the given annotation is public, `false` otherwise. */ /** Return `true` if the given annotation is public, `false` otherwise. */
function isPublic(annotation) { function isPublic(annotation) {
var isPublic = false; let isPublic = false;
if (!annotation.permissions) { if (!annotation.permissions) {
return isPublic; return isPublic;
......
...@@ -284,7 +284,7 @@ function AnnotationController( ...@@ -284,7 +284,7 @@ function AnnotationController(
if (self.annotation.target.length === 0) { if (self.annotation.target.length === 0) {
return null; return null;
} }
var target = self.annotation.target[0]; const target = self.annotation.target[0];
if (!target.selector) { if (!target.selector) {
return null; return null;
} }
......
...@@ -241,7 +241,7 @@ describe('groupList', function () { ...@@ -241,7 +241,7 @@ describe('groupList', function () {
}, },
]; ];
const element = createGroupList(); const element = createGroupList();
var links = element.find('.share-link-container'); const links = element.find('.share-link-container');
assert.equal(links.length, 0); assert.equal(links.length, 0);
}); });
......
...@@ -22,7 +22,7 @@ class FakeSearchClient extends EventEmitter { ...@@ -22,7 +22,7 @@ class FakeSearchClient extends EventEmitter {
assert.ok(query.uri); assert.ok(query.uri);
for (let i = 0; i < query.uri.length; i++) { for (let i = 0; i < query.uri.length; i++) {
var uri = query.uri[i]; const uri = query.uri[i];
this.emit('results', [{id: uri + '123', group: '__world__'}]); this.emit('results', [{id: uri + '123', group: '__world__'}]);
this.emit('results', [{id: uri + '456', group: 'private-group'}]); this.emit('results', [{id: uri + '456', group: 'private-group'}]);
} }
......
...@@ -31,7 +31,7 @@ function Tooltip(rootElement) { ...@@ -31,7 +31,7 @@ function Tooltip(rootElement) {
return; return;
} }
var target = this.state.target; const target = this.state.target;
const label = target.getAttribute('aria-label'); const label = target.getAttribute('aria-label');
this._labelEl.textContent = label; this._labelEl.textContent = label;
......
...@@ -8,7 +8,7 @@ const queryString = require('query-string'); ...@@ -8,7 +8,7 @@ const queryString = require('query-string');
*/ */
function hostPageConfig(window) { function hostPageConfig(window) {
const configJSON = queryString.parse(window.location.search).config; const configJSON = queryString.parse(window.location.search).config;
var config = JSON.parse(configJSON || '{}'); const config = JSON.parse(configJSON || '{}');
// Known configuration parameters which we will import from the host page. // Known configuration parameters which we will import from the host page.
// Note that since the host page is untrusted code, the filtering needs to // Note that since the host page is untrusted code, the filtering needs to
......
...@@ -50,7 +50,7 @@ function features($log, $rootScope, bridge, session) { ...@@ -50,7 +50,7 @@ function features($log, $rootScope, bridge, session) {
return false; return false;
} }
var features = session.state.features; const features = session.state.features;
if (!(flag in features)) { if (!(flag in features)) {
$log.warn('looked up unknown feature', flag); $log.warn('looked up unknown feature', flag);
return false; return false;
......
...@@ -102,7 +102,7 @@ function FrameSync($rootScope, $window, Discovery, store, bridge) { ...@@ -102,7 +102,7 @@ function FrameSync($rootScope, $window, Discovery, store, bridge) {
inFrame.delete(annot.$tag); inFrame.delete(annot.$tag);
}); });
var frames = store.frames(); const frames = store.frames();
if (frames.length > 0) { if (frames.length > 0) {
if (frames.every(function (frame) { return frame.isAnnotationFetchComplete; })) { if (frames.every(function (frame) { return frame.isAnnotationFetchComplete; })) {
if (publicAnns === 0 || publicAnns !== prevPublicAnns) { if (publicAnns === 0 || publicAnns !== prevPublicAnns) {
......
...@@ -298,7 +298,7 @@ describe('rootThread', function () { ...@@ -298,7 +298,7 @@ describe('rootThread', function () {
unroll('adds or updates annotations when #event event occurs', function (testCase) { unroll('adds or updates annotations when #event event occurs', function (testCase) {
$rootScope.$broadcast(testCase.event, testCase.annotations); $rootScope.$broadcast(testCase.event, testCase.annotations);
var annotations = [].concat(testCase.annotations); const annotations = [].concat(testCase.annotations);
assert.notCalled(fakeStore.removeAnnotations); assert.notCalled(fakeStore.removeAnnotations);
assert.calledWith(fakeStore.addAnnotations, sinon.match(annotations)); assert.calledWith(fakeStore.addAnnotations, sinon.match(annotations));
}, [ }, [
...@@ -316,7 +316,7 @@ describe('rootThread', function () { ...@@ -316,7 +316,7 @@ describe('rootThread', function () {
unroll('removes annotations when #event event occurs', function (testCase) { unroll('removes annotations when #event event occurs', function (testCase) {
$rootScope.$broadcast(testCase.event, testCase.annotations); $rootScope.$broadcast(testCase.event, testCase.annotations);
var annotations = [].concat(testCase.annotations); const annotations = [].concat(testCase.annotations);
assert.calledWith(fakeStore.removeAnnotations, sinon.match(annotations)); assert.calledWith(fakeStore.removeAnnotations, sinon.match(annotations));
}, [ }, [
{event: events.ANNOTATION_DELETED, annotations: annot}, {event: events.ANNOTATION_DELETED, annotations: annot},
......
...@@ -90,7 +90,7 @@ function viewFilter(unicode) { ...@@ -90,7 +90,7 @@ function viewFilter(unicode) {
// not be required. // not be required.
return ''; return '';
} }
var target = annotation.target[0]; const target = annotation.target[0];
const selectors = target.selector || []; const selectors = target.selector || [];
return selectors return selectors
......
...@@ -208,7 +208,7 @@ const update = { ...@@ -208,7 +208,7 @@ const update = {
}, },
}; };
var actions = util.actionTypes(update); const actions = util.actionTypes(update);
/** /**
* Updating the flagged status of an annotation. * Updating the flagged status of an annotation.
......
...@@ -43,7 +43,7 @@ function shouldShowInTab(ann, tab) { ...@@ -43,7 +43,7 @@ function shouldShowInTab(ann, tab) {
* @param {Annotation[]} annotations - List of annotations to display * @param {Annotation[]} annotations - List of annotations to display
*/ */
function counts(annotations) { function counts(annotations) {
var counts = { const counts = {
notes: countIf(annotations, metadata.isPageNote), notes: countIf(annotations, metadata.isPageNote),
annotations: countIf(annotations, metadata.isAnnotation), annotations: countIf(annotations, metadata.isAnnotation),
orphans: countIf(annotations, metadata.isOrphan), orphans: countIf(annotations, metadata.isOrphan),
......
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