Skip to content

Commit

Permalink
chore: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
rexdotsh committed Dec 28, 2024
1 parent ebf290f commit 74c1f85
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 25 deletions.
34 changes: 19 additions & 15 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";

export default [
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strict,
...tseslint.configs.stylistic,
{
files: ["**/*.ts"],
ignores: ["scripts/*", "out/*", "dist/*", "test/*", ".vscode-test/*"],
},
{
plugins: {
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 2022,
sourceType: "module",
parser: tseslint.parser,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
},
plugins: {
"@typescript-eslint": tseslint.plugin,
},

rules: {
"@typescript-eslint/naming-convention": [
"warn",
Expand All @@ -24,11 +27,12 @@ export default [
format: ["camelCase", "PascalCase"],
},
],

"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "off",
curly: "warn",
eqeqeq: "warn",
"no-throw-literal": "warn",
semi: "off",
},
},
];
}
);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
"npm-run-all": "^4.1.5",
"ts-loader": "^9.5.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.2",
"webpack-cli": "^6.0.1"
}
}
6 changes: 3 additions & 3 deletions src/claude/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class ClaudeClient {
this.sessionToken = config.sessionToken;
}

private async makeRequest<T>(method: string, endpoint: string, data?: any): Promise<T> {
private async makeRequest<T>(method: string, endpoint: string, data?: Record<string, unknown>): Promise<T> {
try {
const url = `${this.baseUrl}${endpoint}`;
console.log(`Making ${method} request to ${url}`);
Expand Down Expand Up @@ -181,11 +181,11 @@ export class ClaudeClient {
}

async deleteFile(organizationId: string, projectId: string, fileUuid: string): Promise<void> {
await this.makeRequest<void>("DELETE", `/organizations/${organizationId}/projects/${projectId}/docs/${fileUuid}`);
await this.makeRequest("DELETE", `/organizations/${organizationId}/projects/${projectId}/docs/${fileUuid}`);
}

async updateProjectPromptTemplate(organizationId: string, projectId: string, promptTemplate: string): Promise<void> {
await this.makeRequest<void>("PUT", `/organizations/${organizationId}/projects/${projectId}`, {
await this.makeRequest("PUT", `/organizations/${organizationId}/projects/${projectId}`, {
prompt_template: promptTemplate,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ export async function activate(context: vscode.ExtensionContext) {
const result = await syncManager.syncFiles([uri]);

if (result.success) {
if (result.data?.syncedFiles > 0) {
if ((result.data?.syncedFiles ?? 0) > 0) {
vscode.window.showInformationMessage(
`${relativePath} included in sync and uploaded to Claude project`
);
Expand Down
2 changes: 1 addition & 1 deletion src/gitignoreManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class GitignoreManager {
return path.replace(/\\/g, "/").replace(/^\/+|\/+$/g, "");
}

public static isMatch(pattern: string, filePath: string, isDirectory: boolean = false): boolean {
public static isMatch(pattern: string, filePath: string, isDirectory = false): boolean {
pattern = this.normalizePath(pattern);
filePath = this.normalizePath(filePath);

Expand Down
2 changes: 1 addition & 1 deletion src/syncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class SyncManager {
if (typeof result === "object" && result !== null && "success" in result) {
return result as SyncResult;
}
return { success: true, data: result };
return { success: true, data: { syncedFiles: 0 } };
} catch (error) {
this.outputChannel.appendLine(`Error in ${operation}: ${error instanceof Error ? error.message : String(error)}`);
if (error instanceof Error && error.stack) {
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ export interface SyncResult {
success: boolean;
message?: string;
error?: Error;
data?: any;
data?: {
syncedFiles: number;
};
}
15 changes: 12 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,12 @@
dependencies:
undici-types "~6.19.2"

"@types/vscode@^1.96.0":
"@types/vscode@^1.90.0":
version "1.96.0"
resolved "https://registry.yarnpkg.com/@types/vscode/-/vscode-1.96.0.tgz#3181004bf25d71677ae4aacdd7605a3fd7edf08e"
integrity sha512-qvZbSZo+K4ZYmmDuaodMbAa67Pl6VDQzLKFka6rq+3WUTY4Kro7Bwoi0CuZLO/wema0ygcmpwow7zZfPJTs5jg==

"@typescript-eslint/eslint-plugin@^8.17.0":
"@typescript-eslint/eslint-plugin@8.18.2", "@typescript-eslint/eslint-plugin@^8.17.0":
version "8.18.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.18.2.tgz#c78e363ab5fe3b21dd1c90d8be9581534417f78e"
integrity sha512-adig4SzPLjeQ0Tm+jvsozSGiCliI2ajeURDGHjZ2llnA+A67HihCQ+a3amtPhUakd1GlwHxSRvzOZktbEvhPPg==
Expand All @@ -439,7 +439,7 @@
natural-compare "^1.4.0"
ts-api-utils "^1.3.0"

"@typescript-eslint/parser@^8.17.0":
"@typescript-eslint/parser@8.18.2", "@typescript-eslint/parser@^8.17.0":
version "8.18.2"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.18.2.tgz#0379a2e881d51d8fcf7ebdfa0dd18eee79182ce2"
integrity sha512-y7tcq4StgxQD4mDr9+Jb26dZ+HTZ/SkfqpXSiqeUXZHxOUyjWDKsmwKhJ0/tApR08DgOhrFAoAhyB80/p3ViuA==
Expand Down Expand Up @@ -3715,6 +3715,15 @@ typed-rest-client@^1.8.4:
tunnel "0.0.6"
underscore "^1.12.1"

typescript-eslint@^8.18.2:
version "8.18.2"
resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.18.2.tgz#71334dcf843adc3fbb771dce5ade7876aa0d62b7"
integrity sha512-KuXezG6jHkvC3MvizeXgupZzaG5wjhU3yE8E7e6viOvAvD9xAWYp8/vy0WULTGe9DYDWcQu7aW03YIV3mSitrQ==
dependencies:
"@typescript-eslint/eslint-plugin" "8.18.2"
"@typescript-eslint/parser" "8.18.2"
"@typescript-eslint/utils" "8.18.2"

typescript@^5.7.2:
version "5.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.2.tgz#3169cf8c4c8a828cde53ba9ecb3d2b1d5dd67be6"
Expand Down

0 comments on commit 74c1f85

Please sign in to comment.