Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
RozmarinUS committed Jul 12, 2023
1 parent 1292e4b commit 89b008e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
"extends": "marine/prettier/node",
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"rules": {
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Install Node v14
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 18

- name: Install dependencies
run: npm ci
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function sendActivity() {
state = {
...(await activity(state)),
};
rpc.setActivity(state);
return rpc.setActivity(state);
}

async function login() {
Expand All @@ -53,17 +53,16 @@ async function login() {

rpc.on('disconnected', () => {
cleanUp();
rpc.destroy();
statusBarIcon.text = '$(pulse) Reconnect to Discord';
statusBarIcon.command = 'discord.reconnect';
void rpc.destroy();
});

try {
await rpc.login({ clientId: CLIENT_ID });
} catch (error: any) {
log(LogLevel.Error, `Encountered the following error while trying to login:\n${error as string}`);
cleanUp();
rpc.destroy();
if (!config[CONFIG_KEYS.SuppressNotifications]) {
if (error?.message?.includes('ENOENT')) {
void window.showErrorMessage('No Discord client detected');
Expand All @@ -73,6 +72,7 @@ async function login() {
}
statusBarIcon.text = '$(pulse) Reconnect to Discord';
statusBarIcon.command = 'discord.reconnect';
return rpc.destroy();
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ export async function activate(context: ExtensionContext) {
}
log(LogLevel.Info, 'Disable: Cleaning up old listeners');
cleanUp();
rpc.destroy();
void rpc.destroy();
log(LogLevel.Info, 'Disable: Destroyed the rpc instance');
statusBarIcon.hide();
};
Expand Down
2 changes: 1 addition & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function log(level: LogLevel, message: string | Error | object) {
try {
const json = JSON.stringify(message, null, 2);
send(level, json);
} catch (error) {
} catch (error: unknown) {
console.error(`Failed to stringify log message: ${error}`);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export function resolveFileIcon(document: TextDocument): string {
const filename = basename(document.fileName);
const findKnownExtension = Object.keys(KNOWN_EXTENSIONS)
.sort((a, b) => {
const aIsRegular = KNOWN_EXTENSIONS[a].isRegular || false;
const bIsRegular = KNOWN_EXTENSIONS[b].isRegular || false;
const aIsRegular = KNOWN_EXTENSIONS[a].isRegular ?? false;
const bIsRegular = KNOWN_EXTENSIONS[b].isRegular ?? false;

if (aIsRegular && !bIsRegular) {
return -1;
Expand Down

0 comments on commit 89b008e

Please sign in to comment.