fix(client): fix lint issues in scripts (#8621)
This commit is contained in:
parent
ad860905c6
commit
a975a0971c
17 changed files with 75 additions and 85 deletions
|
|
@ -74,21 +74,21 @@ export class Autocomplete {
|
|||
emojiIndex,
|
||||
mfmTagIndex);
|
||||
|
||||
if (max == -1) {
|
||||
if (max === -1) {
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
|
||||
const isMention = mentionIndex != -1;
|
||||
const isHashtag = hashtagIndex != -1;
|
||||
const isMfmTag = mfmTagIndex != -1;
|
||||
const isEmoji = emojiIndex != -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':');
|
||||
const isMention = mentionIndex !== -1;
|
||||
const isHashtag = hashtagIndex !== -1;
|
||||
const isMfmTag = mfmTagIndex !== -1;
|
||||
const isEmoji = emojiIndex !== -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':');
|
||||
|
||||
let opened = false;
|
||||
|
||||
if (isMention) {
|
||||
const username = text.substr(mentionIndex + 1);
|
||||
if (username != '' && username.match(/^[a-zA-Z0-9_]+$/)) {
|
||||
if (username !== '' && username.match(/^[a-zA-Z0-9_]+$/)) {
|
||||
this.open('user', username);
|
||||
opened = true;
|
||||
} else if (username === '') {
|
||||
|
|
@ -130,7 +130,7 @@ export class Autocomplete {
|
|||
* サジェストを提示します。
|
||||
*/
|
||||
private async open(type: string, q: string | null) {
|
||||
if (type != this.currentType) {
|
||||
if (type !== this.currentType) {
|
||||
this.close();
|
||||
}
|
||||
if (this.opening) return;
|
||||
|
|
@ -201,7 +201,7 @@ export class Autocomplete {
|
|||
|
||||
const caret = this.textarea.selectionStart;
|
||||
|
||||
if (type == 'user') {
|
||||
if (type === 'user') {
|
||||
const source = this.text;
|
||||
|
||||
const before = source.substr(0, caret);
|
||||
|
|
@ -219,7 +219,7 @@ export class Autocomplete {
|
|||
const pos = trimmedBefore.length + (acct.length + 2);
|
||||
this.textarea.setSelectionRange(pos, pos);
|
||||
});
|
||||
} else if (type == 'hashtag') {
|
||||
} else if (type === 'hashtag') {
|
||||
const source = this.text;
|
||||
|
||||
const before = source.substr(0, caret);
|
||||
|
|
@ -235,7 +235,7 @@ export class Autocomplete {
|
|||
const pos = trimmedBefore.length + (value.length + 2);
|
||||
this.textarea.setSelectionRange(pos, pos);
|
||||
});
|
||||
} else if (type == 'emoji') {
|
||||
} else if (type === 'emoji') {
|
||||
const source = this.text;
|
||||
|
||||
const before = source.substr(0, caret);
|
||||
|
|
@ -251,7 +251,7 @@ export class Autocomplete {
|
|||
const pos = trimmedBefore.length + value.length;
|
||||
this.textarea.setSelectionRange(pos, pos);
|
||||
});
|
||||
} else if (type == 'mfmTag') {
|
||||
} else if (type === 'mfmTag') {
|
||||
const source = this.text;
|
||||
|
||||
const before = source.substr(0, caret);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue