more strict lint
This commit is contained in:
parent
c5529958d5
commit
9ae814dfe4
21 changed files with 211 additions and 157 deletions
|
@ -12,9 +12,8 @@ const reopenTab = () => {
|
|||
let session = sessions[0];
|
||||
if (session.tab) {
|
||||
return browser.sessions.restore(session.tab.sessionId);
|
||||
} else {
|
||||
return browser.sessions.restore(session.window.sessionId);
|
||||
}
|
||||
return browser.sessions.restore(session.window.sessionId);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -24,20 +23,20 @@ const selectAt = (index) => {
|
|||
return;
|
||||
}
|
||||
if (index < 0 || tabs.length <= index) {
|
||||
throw new RangeError(`tab ${index} does not exist`)
|
||||
throw new RangeError(`tab ${index} does not exist`);
|
||||
}
|
||||
let id = tabs[index].id;
|
||||
return browser.tabs.update(id, { active: true })
|
||||
return browser.tabs.update(id, { active: true });
|
||||
});
|
||||
};
|
||||
|
||||
const selectByKeyword = (current, keyword) => {
|
||||
return browser.tabs.query({ currentWindow: true }).then((tabs) => {
|
||||
let matched = tabs.filter((t) => {
|
||||
return t.url.includes(keyword) || t.title.includes(keyword)
|
||||
})
|
||||
return t.url.includes(keyword) || t.title.includes(keyword);
|
||||
});
|
||||
|
||||
if (matched.length == 0) {
|
||||
if (matched.length === 0) {
|
||||
throw new RangeError('No matching buffer for ' + keyword);
|
||||
}
|
||||
for (let tab of matched) {
|
||||
|
@ -47,13 +46,13 @@ const selectByKeyword = (current, keyword) => {
|
|||
}
|
||||
return browser.tabs.update(matched[0].id, { active: true });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getCompletions = (keyword) => {
|
||||
return browser.tabs.query({ currentWindow: true }).then((tabs) => {
|
||||
let matched = tabs.filter((t) => {
|
||||
return t.url.includes(keyword) || t.title.includes(keyword)
|
||||
})
|
||||
return t.url.includes(keyword) || t.title.includes(keyword);
|
||||
});
|
||||
return matched;
|
||||
});
|
||||
};
|
||||
|
@ -63,9 +62,9 @@ const selectPrevTab = (current, count) => {
|
|||
if (tabs.length < 2) {
|
||||
return;
|
||||
}
|
||||
let select = (current - count) % tabs.length
|
||||
let select = (current - count) % tabs.length;
|
||||
let id = tabs[select].id;
|
||||
return browser.tabs.update(id, { active: true })
|
||||
return browser.tabs.update(id, { active: true });
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -74,9 +73,9 @@ const selectNextTab = (current, count) => {
|
|||
if (tabs.length < 2) {
|
||||
return;
|
||||
}
|
||||
let select = (current + count + tabs.length) % tabs.length
|
||||
let select = (current + count + tabs.length) % tabs.length;
|
||||
let id = tabs[select].id;
|
||||
return browser.tabs.update(id, { active: true })
|
||||
return browser.tabs.update(id, { active: true });
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -87,4 +86,7 @@ const reload = (current, cache) => {
|
|||
);
|
||||
};
|
||||
|
||||
export { closeTab, reopenTab, selectAt, selectByKeyword, getCompletions, selectPrevTab, selectNextTab, reload };
|
||||
export {
|
||||
closeTab, reopenTab, selectAt, selectByKeyword, getCompletions,
|
||||
selectPrevTab, selectNextTab, reload
|
||||
};
|
||||
|
|
Reference in a new issue