Skip to content

Commit

Permalink
fix: eslint error
Browse files Browse the repository at this point in the history
  • Loading branch information
xpadev-net committed Apr 12, 2024
1 parent 9a5a255 commit 59fc0dd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/comments/FlashComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FlashComment extends BaseComment {
override buttonImage: IRenderer;
constructor(comment: FormattedComment, renderer: IRenderer, index: number) {
super(comment, renderer, index);
this._globalScale ??= getConfig(config.commentScale, true);
this._globalScale = getConfig(config.commentScale, true);
this.buttonImage = renderer.getCanvas();
}

Expand Down
8 changes: 4 additions & 4 deletions src/comments/HTML5Comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class HTML5Comment extends BaseComment {

for (let i = 0, n = comment.content.length; i < n; i++) {
const item = comment.content[i];
if (item?.type !== "text" || !itemWidth) continue;
if (item?.type !== "text" || !itemWidth[i]) continue;
item.width = itemWidth[i];
}
comment.fontSize = (comment.charSize ?? 0) * 0.8;
Expand Down Expand Up @@ -247,7 +247,7 @@ class HTML5Comment extends BaseComment {
(this.comment.lineHeight * (i + 1) +
(this.comment.charSize - this.comment.lineHeight) / 2 +
this.comment.lineHeight * -0.16 +
(config.fonts.html5[this.comment.font]?.offset || 0)) *
(config.fonts.html5[this.comment.font].offset || 0)) *
scale;
this.renderer.setStrokeStyle("rgba(255,255,0,0.5)");
this.renderer.strokeRect(
Expand Down Expand Up @@ -287,9 +287,9 @@ class HTML5Comment extends BaseComment {
const offsetY =
(this.comment.charSize - this.comment.lineHeight) / 2 +
this.comment.lineHeight * -0.16 +
(config.fonts.html5[this.comment.font]?.offset || 0);
(config.fonts.html5[this.comment.font].offset || 0);
for (const item of this.comment.content) {
if (item?.type === "spacer") {
if (item.type === "spacer") {
lineCount += item.count * item.charWidth * this.comment.fontSize;
continue;
}
Expand Down
3 changes: 0 additions & 3 deletions src/utils/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ const arrayPush = (
key: string | number,
push: IComment,
) => {
if (!array) {
array = {};
}
if (!array[Number(key)]) {
array[Number(key)] = [];
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const nicoscriptReplaceIgnoreable = (
(item.condition === "\u5b8c\u5168\u4e00\u81f4" &&
comment.content !== item.keyword) ||
(item.condition === "\u90e8\u5206\u4e00\u81f4" &&
comment.content.indexOf(item.keyword) === -1);
!comment.content.includes(item.keyword));

/**
* 置換コマンドを適用する
Expand Down Expand Up @@ -408,9 +408,9 @@ const processAtButton = (
groups: { before?: string; body?: string; after?: string };
};
const message = {
before: content.groups?.before ?? "",
body: content.groups?.body ?? "",
after: content.groups?.after ?? "",
before: content.groups.before ?? "",
body: content.groups.body ?? "",
after: content.groups.after ?? "",
};
commands.button = {
message,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/commentArt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const getUsersScore = (
): { [key: string]: number } => {
const userScoreList: { [key: number]: number } = {};
for (const comment of comments) {
if (comment.user_id === undefined || comment.user_id === -1) continue;
if (comment.user_id === -1) continue;
userScoreList[comment.user_id] ||= 0;
if (
comment.mail.includes("ca") ||
Expand Down

0 comments on commit 59fc0dd

Please sign in to comment.