Skip to content

Commit

Permalink
code cleanup (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid authored Nov 26, 2024
1 parent 029d6da commit e7afbd1
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 25 deletions.
4 changes: 3 additions & 1 deletion packages/backend/src/core/FileInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ export class FileInfoService {
watcher.close();
});
command.run();
for (let i = 1; true; i++) { // eslint-disable-line @typescript-eslint/no-unnecessary-condition
let i = 0;
while (true) {
i++;
const current = `${i}.png`;
const next = `${i + 1}.png`;
const framePath = join(cwd, current);
Expand Down
3 changes: 1 addition & 2 deletions packages/backend/src/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export function bindThis(target: any, key: string, descriptor: any) {
return {
configurable: true,
get() {
// eslint-disable-next-line no-prototype-builtins
if (this === target.prototype || this.hasOwnProperty(key) ||
if (this === target.prototype || Object.hasOwn(this, key) ||
typeof fn !== 'function') {
return fn;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/server/oauth/OAuth2ProviderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function getQueryMode(issuerUrl: string): oauth2orize.grant.Options['modes'] {
parsed.searchParams.append(key, value as string);
}

return (res as OAuthHttpResponse).redirect(parsed.toString());
(res as OAuthHttpResponse).redirect(parsed.toString());
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/server/web/bios.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

* {
font-family: Fira code, Fira Mono, Consolas, Menlo, Courier, monospace;
font-family: 'Fira code', 'Fira Mono', Consolas, Menlo, Courier, monospace;
}

html {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/server/web/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}

//#region Detect language & fetch translations
if (!localStorage.hasOwnProperty('locale')) {
if (!Object.hasOwn(localStorage, 'locale')) {
let lang = localStorage.getItem('lang');
if (lang == null || lang.toString == null || lang.toString() === 'null') {
lang = 'ja-JP';
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/server/web/cli.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

* {
font-family: Fira code, Fira Mono, Consolas, Menlo, Courier, monospace;
font-family: 'Fira code', 'Fira Mono', Consolas, Menlo, Courier, monospace;
}

html {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/server/web/flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ message('Start flushing.');

console.error(e);
setTimeout(() => {
location = '/';
window.location = '/';
}, 10000)
}
})();
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/test-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": true,
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": true,
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/test/unit/ap-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import httpSignature from '@peertube/http-signature';
import { genRsaKeyPair } from '@/misc/gen-key-pair.js';
import { ApRequestCreator } from '@/core/activitypub/ApRequestService.js';

export const buildParsedSignature = (signingString: string, signature: string, algorithm: string) => {
const buildParsedSignature = (signingString: string, signature: string, algorithm: string) => {
return {
scheme: 'Signature',
params: {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": false,
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ const keymap = {
'down|j|tab': focusAfter,
'esc': blur,
'm|o': () => showMenu(true),
's': () => showContent.value !== showContent.value,
's': () => { showContent.value = !showContent.value; focus(); },
};

provide('react', (reaction: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ const keymap = {
'q': () => renote(true),
'esc': blur,
'm|o': () => showMenu(true),
's': () => showContent.value !== showContent.value,
's': () => { showContent.value = !showContent.value; focus(); },
};

provide('react', (reaction: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkPollEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function get(): PollEditorModelValue {
};

const calcAfter = () => {
let base = parseInt(after.value.toString());
let base = Number.parseInt(after.value.toString());
switch (unit.value) {
// @ts-expect-error fallthrough
case 'day': base *= 24;
Expand Down
2 changes: 0 additions & 2 deletions packages/frontend/src/unicode-emoji-indexes/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@
"👸": ["girl", "woman", "female", "blond", "crown", "royal", "queen"],
"🤴": ["boy", "man", "male", "crown", "royal", "king"],
"👰": ["couple", "marriage", "wedding", "woman", "bride"],
"👰": ["couple", "marriage", "wedding", "woman", "bride"],
"🤵": ["couple", "marriage", "wedding", "groom"],
"🤵": ["couple", "marriage", "wedding", "groom"],
"🏃‍♀️": ["woman", "walking", "exercise", "race", "running", "female"],
"🏃": ["man", "walking", "exercise", "race", "running"],
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": true,
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": false,
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"removeComments": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/misskey-bubble-game/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ export class DropAndFusionGame extends EventEmitter<{
} else if (mono.shape === 'rectangle') {
return Matter.Bodies.rectangle(x, y, mono.sizeX, mono.sizeY, options);
} else if (mono.shape === 'custom') {
return Matter.Bodies.fromVertices(x, y, mono.vertices!.map(i => i.map(j => ({
return Matter.Bodies.fromVertices(x, y, mono.vertices?.map(i => i.map(j => ({
x: (j.x / mono.verticesSize!) * mono.sizeX,
y: (j.y / mono.verticesSize!) * mono.sizeY,
}))), options);
}))) ?? [], options);
} else {
throw new Error('unrecognized shape');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-bubble-game/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-reversi/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"declaration": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/sw/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noFallthroughCasesInSwitch": true,
"declaration": false,
"sourceMap": false,
"target": "ES2022",
"target": "es2022",
"module": "nodenext",
"moduleResolution": "nodenext",
"removeComments": false,
Expand Down

0 comments on commit e7afbd1

Please sign in to comment.