client: linting

This commit is contained in:
Shyam Sunder 2021-11-29 18:44:20 -05:00
parent 9b3123a815
commit 9f95e9eb90
9 changed files with 20 additions and 32 deletions

View file

@ -31,9 +31,8 @@ class UserController {
userTokenPromise = UserToken.get(userName).then( userTokenPromise = UserToken.get(userName).then(
(userTokens) => { (userTokens) => {
return userTokens.map((token) => { return userTokens.map((token) => {
token.isCurrentAuthToken = api.isCurrentAuthToken( token.isCurrentAuthToken =
token api.isCurrentAuthToken(token);
);
return token; return token;
}); });
}, },

View file

@ -45,9 +45,8 @@ class ExpanderControl {
// eslint-disable-next-line accessor-pairs // eslint-disable-next-line accessor-pairs
set title(newTitle) { set title(newTitle) {
if (this._expanderNode) { if (this._expanderNode) {
this._expanderNode.querySelector( this._expanderNode.querySelector("header span").textContent =
"header span" newTitle;
).textContent = newTitle;
} }
} }

View file

@ -203,9 +203,8 @@ class PostEditSidebarControl extends events.EventTarget {
); );
if (this._formNode) { if (this._formNode) {
const inputNodes = this._formNode.querySelectorAll( const inputNodes =
"input, textarea" this._formNode.querySelectorAll("input, textarea");
);
for (let node of inputNodes) { for (let node of inputNodes) {
node.addEventListener("change", (e) => node.addEventListener("change", (e) =>
this.dispatchEvent(new CustomEvent("change")) this.dispatchEvent(new CustomEvent("change"))

View file

@ -727,9 +727,8 @@ class PostNotesOverlayControl extends events.EventTarget {
} }
_showNoteText(note) { _showNoteText(note) {
this._textNode.querySelector( this._textNode.querySelector(".wrapper").innerHTML =
".wrapper" misc.formatMarkdown(note.text);
).innerHTML = misc.formatMarkdown(note.text);
this._textNode.style.display = "block"; this._textNode.style.display = "block";
const bodyRect = document.body.getBoundingClientRect(); const bodyRect = document.body.getBoundingClientRect();
const noteRect = this._textNode.getBoundingClientRect(); const noteRect = this._textNode.getBoundingClientRect();

View file

@ -136,12 +136,8 @@ function createRenderer() {
const renderer = new marked.Renderer(); const renderer = new marked.Renderer();
renderer.image = (href, title, alt) => { renderer.image = (href, title, alt) => {
let [ let [_, url, width, height] =
_, /^(.+?)(?:\s=\s*(\d*)\s*x\s*(\d*)\s*)?$/.exec(href);
url,
width,
height,
] = /^(.+?)(?:\s=\s*(\d*)\s*x\s*(\d*)\s*)?$/.exec(href);
let res = '<img src="' + sanitize(url) + '" alt="' + sanitize(alt); let res = '<img src="' + sanitize(url) + '" alt="' + sanitize(alt);
if (width) { if (width) {
res += '" width="' + width; res += '" width="' + width;

View file

@ -25,9 +25,8 @@ class PostMainView {
views.replaceContent(this._hostNode, sourceNode); views.replaceContent(this._hostNode, sourceNode);
views.syncScrollPosition(); views.syncScrollPosition();
const topNavigationNode = document.body.querySelector( const topNavigationNode =
"#top-navigation" document.body.querySelector("#top-navigation");
);
this._postContentControl = new PostContentControl( this._postContentControl = new PostContentControl(
postContainerNode, postContainerNode,

View file

@ -360,8 +360,8 @@ class PostUploadView extends events.EventTarget {
detail: { detail: {
uploadables: this._uploadables, uploadables: this._uploadables,
skipDuplicates: this._skipDuplicatesCheckboxNode.checked, skipDuplicates: this._skipDuplicatesCheckboxNode.checked,
alwaysUploadSimilar: this._alwaysUploadSimilarCheckboxNode alwaysUploadSimilar:
.checked, this._alwaysUploadSimilarCheckboxNode.checked,
}, },
}) })
); );

View file

@ -253,9 +253,8 @@ class PostsHeaderView extends events.EventTarget {
e.target.classList.toggle("disabled"); e.target.classList.toggle("disabled");
const safety = e.target.getAttribute("data-safety"); const safety = e.target.getAttribute("data-safety");
let browsingSettings = settings.get(); let browsingSettings = settings.get();
browsingSettings.listPosts[safety] = !browsingSettings.listPosts[ browsingSettings.listPosts[safety] =
safety !browsingSettings.listPosts[safety];
];
settings.save(browsingSettings, true); settings.save(browsingSettings, true);
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("navigate", { new CustomEvent("navigate", {

View file

@ -72,9 +72,8 @@ class UserTokenView extends events.EventTarget {
_evtDelete(e) { _evtDelete(e) {
e.preventDefault(); e.preventDefault();
const userToken = this._tokens[ const userToken =
parseInt(e.target.getAttribute("data-token-id")) this._tokens[parseInt(e.target.getAttribute("data-token-id"))];
];
this.dispatchEvent( this.dispatchEvent(
new CustomEvent("delete", { new CustomEvent("delete", {
detail: { detail: {
@ -110,9 +109,8 @@ class UserTokenView extends events.EventTarget {
_evtChangeNoteClick(e) { _evtChangeNoteClick(e) {
e.preventDefault(); e.preventDefault();
const userToken = this._tokens[ const userToken =
parseInt(e.target.getAttribute("data-token-id")) this._tokens[parseInt(e.target.getAttribute("data-token-id"))];
];
const text = window.prompt( const text = window.prompt(
"Please enter the new name:", "Please enter the new name:",
userToken.note !== null ? userToken.note : undefined userToken.note !== null ? userToken.note : undefined