Skip to content

Commit a2d2bc8

Browse files
jaggederestclaude
andcommitted
fix: resolve ESLint @typescript-eslint/require-await errors
- Add parserOptions.project to enable type-aware linting - Disable @typescript-eslint/require-await rule for markdown files - Remove unnecessary async keywords from functions without await 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3097d8f commit a2d2bc8

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

.eslintrc.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"parser": "@typescript-eslint/parser",
44
"parserOptions": {
55
"ecmaVersion": 6,
6-
"sourceType": "module"
6+
"sourceType": "module",
7+
"project": "./tsconfig.json"
78
},
89
"plugins": ["@typescript-eslint", "prettier"],
910
"extends": [
@@ -17,7 +18,10 @@
1718
"overrides": [
1819
{
1920
"files": ["*.md"],
20-
"parser": "markdown-eslint-parser"
21+
"parser": "markdown-eslint-parser",
22+
"rules": {
23+
"@typescript-eslint/require-await": "off"
24+
}
2125
}
2226
],
2327
"rules": {

src/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export async function createHttpAgent(): Promise<ProxyAgent> {
7171
* configuration. The token may be undefined if some other form of
7272
* authentication is being used.
7373
*/
74-
export async function makeCoderSdk(
74+
export function makeCoderSdk(
7575
baseUrl: string,
7676
token: string | undefined,
7777
storage: Storage,
78-
): Promise<Api> {
78+
): Api {
7979
const restClient = new Api();
8080
restClient.setHost(baseUrl);
8181
if (token) {

src/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class CertificateError extends Error {
126126
}
127127

128128
// allowInsecure updates the value of the "coder.insecure" property.
129-
async allowInsecure(): Promise<void> {
129+
allowInsecure(): void {
130130
vscode.workspace
131131
.getConfiguration()
132132
.update("coder.insecure", true, vscode.ConfigurationTarget.Global);

src/util.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect } from "vitest";
22
import { countSubstring, parseRemoteAuthority, toSafeHost } from "./util";
33

4-
it("ignore unrelated authorities", async () => {
4+
it("ignore unrelated authorities", () => {
55
const tests = [
66
"vscode://ssh-remote+some-unrelated-host.com",
77
"vscode://ssh-remote+coder-vscode",
@@ -15,7 +15,7 @@ it("ignore unrelated authorities", async () => {
1515
}
1616
});
1717

18-
it("should error on invalid authorities", async () => {
18+
it("should error on invalid authorities", () => {
1919
const tests = [
2020
"vscode://ssh-remote+coder-vscode--foo",
2121
"vscode://ssh-remote+coder-vscode--",
@@ -27,7 +27,7 @@ it("should error on invalid authorities", async () => {
2727
}
2828
});
2929

30-
it("should parse authority", async () => {
30+
it("should parse authority", () => {
3131
expect(
3232
parseRemoteAuthority("vscode://ssh-remote+coder-vscode--foo--bar"),
3333
).toStrictEqual({
@@ -81,7 +81,7 @@ it("should parse authority", async () => {
8181
});
8282
});
8383

84-
it("escapes url host", async () => {
84+
it("escapes url host", () => {
8585
expect(toSafeHost("https://foobar:8080")).toBe("foobar");
8686
expect(toSafeHost("https://ほげ")).toBe("xn--18j4d");
8787
expect(toSafeHost("https://test.😉.invalid")).toBe("test.xn--n28h.invalid");

src/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const RemoteSSHLogPortRegex =
2525
*
2626
* Returns null if no port is found.
2727
*/
28-
export async function findPort(text: string): Promise<number | null> {
28+
export function findPort(text: string): number | null {
2929
const matches = text.match(RemoteSSHLogPortRegex);
3030
if (!matches) {
3131
return null;

src/workspacesProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class WorkspaceProvider
156156

157157
// Create tree items for each workspace
158158
const workspaceTreeItems = await Promise.all(
159-
resp.workspaces.map(async (workspace) => {
159+
resp.workspaces.map((workspace) => {
160160
const workspaceTreeItem = new WorkspaceTreeItem(
161161
workspace,
162162
this.getWorkspacesQuery === WorkspaceQuery.All,
@@ -235,7 +235,7 @@ export class WorkspaceProvider
235235
this._onDidChangeTreeData.fire(item);
236236
}
237237

238-
async getTreeItem(element: vscode.TreeItem): Promise<vscode.TreeItem> {
238+
getTreeItem(element: vscode.TreeItem): vscode.TreeItem {
239239
return element;
240240
}
241241

0 commit comments

Comments
 (0)