Fix all 93 ESLint issues (3 errors, 90 warnings) (#666)

This commit is contained in:
Thomas Durieux
2026-04-15 09:04:22 +02:00
committed by GitHub
parent 1d97c76e7e
commit f4209110c7
28 changed files with 77 additions and 69 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ export default class GitHubDownload extends GitHubBase {
response = await this.getZipUrl();
} catch (error) {
throw new AnonymousError("repo_not_found", {
httpStatus: (error as any).status || 404,
httpStatus: (error as { status?: number }).status || 404,
object: this.data,
cause: error as Error,
});
+3 -3
View File
@@ -99,7 +99,7 @@ export class GitHubRepository {
}
} catch (error) {
throw new AnonymousError("repo_not_found", {
httpStatus: (error as any).status,
httpStatus: (error as { status?: number }).status,
cause: error as Error,
object: this,
});
@@ -212,7 +212,7 @@ export async function getRepositoryFromGitHub(opt: {
if (opt.repo.indexOf(".git") > -1) {
opt.repo = opt.repo.replace(".git", "");
}
let dbModel = null;
let dbModel;
if (opt.repositoryID) {
dbModel = isConnected
? await RepositoryModel.findById(opt.repositoryID)
@@ -255,7 +255,7 @@ export async function getRepositoryFromGitHub(opt: {
});
}
throw new AnonymousError("repo_not_found", {
httpStatus: (error as any).status,
httpStatus: (error as { status?: number }).status,
object: {
owner: opt.owner,
repo: opt.repo,
+5 -5
View File
@@ -70,7 +70,7 @@ export default class GitHubStream extends GitHubBase {
content.on("error", (error) => {
error = new AnonymousError("file_not_found", {
httpStatus: (error as any).status || (error as any).httpStatus,
httpStatus: (error as { status?: number; httpStatus?: number }).status || (error as { httpStatus?: number }).httpStatus,
cause: error as Error,
object: filePath,
});
@@ -85,7 +85,7 @@ export default class GitHubStream extends GitHubBase {
async getFileContent(file: AnonymizedFile): Promise<stream.Readable> {
try {
void file.filePath;
} catch (_) {
} catch {
// compute the original path if ambiguous
await file.originalPath();
}
@@ -139,7 +139,7 @@ export default class GitHubStream extends GitHubBase {
file: 0,
};
const output: IFile[] = [];
let data = null;
let data;
try {
data = await this.getGHTree(sha, count, {
recursive: false,
@@ -152,12 +152,12 @@ export default class GitHubStream extends GitHubBase {
output.push(...this.tree2Tree(data.tree, parentPath));
} catch (error) {
console.log(error);
if ((error as any).status == 409 || (error as any).status == 404) {
if ((error as { status?: number }).status == 409 || (error as { status?: number }).status == 404) {
// empty repo
data = { tree: [] };
} else {
throw new AnonymousError("repo_not_found", {
httpStatus: (error as any).status || 404,
httpStatus: (error as { status?: number }).status || 404,
object: this.data,
cause: error as Error,
});
+2 -1
View File
@@ -8,6 +8,7 @@ export default class Zip implements SourceBase {
type = "Zip";
url?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(data: any, readonly repoId: string) {
this.url = data.url;
}
@@ -28,7 +29,7 @@ export default class Zip implements SourceBase {
return storage.read(file.repository.repoId, file.filePath);
}
toJSON(): any {
toJSON(): { type: string } {
return {
type: this.type,
};