Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #49 from indeedeng/OSST-1140-FixLintErrors
Browse files Browse the repository at this point in the history
Fix lint errors
  • Loading branch information
kevindigo authored Oct 13, 2020
2 parents ef053ba + 229e664 commit c288d7c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"no-unused-vars": "off", // Needs to be disabled for @typescript/no-unused-vars to work
"no-use-before-define": "error",
"no-use-before-define": "off",
"no-useless-call": "error",
"no-useless-concat": "error",
"no-with": "error",
Expand Down
20 changes: 6 additions & 14 deletions src/dependency-details-retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ abstract class BaseRestfulGithubDataFetcher<T> extends DataFetcher<T> {
this.httpClient = httpClient;
}

// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected extractFundingUrl(responseJson: any, requestUrl: string): string | null {
if (Array.isArray(responseJson)) {
Expand All @@ -33,7 +32,6 @@ abstract class BaseRestfulGithubDataFetcher<T> extends DataFetcher<T> {
TabDepthLogger.error(0, errorMessage);
}

// tslint:disable-next-line: no-null-keyword
return null;
}
protected createErrorMessage(err: Error, requestUrl: string): string {
Expand Down Expand Up @@ -75,7 +73,6 @@ class RestfulOwnersDataFetcher extends BaseRestfulGithubDataFetcher<string | nul
ownerDataCollection: OwnerDataCollection
): void {
ownerDataCollection.updateOwnerData(params.owner, (ownerData) => {
// eslint-disable-next-line @typescript-eslint/camelcase
ownerData.funding_url = fundingUrl;

return ownerData;
Expand Down Expand Up @@ -110,10 +107,7 @@ class RestfulDependenciesDataFetcher extends BaseRestfulGithubDataFetcher<string
const libraryUrl = this.getURL(params);

return {
// eslint-disable-next-line @typescript-eslint/camelcase
funding_url: fundingUrl,
// tslint:disable-next-line: no-null-keyword
// eslint-disable-next-line @typescript-eslint/camelcase
html_url: this.getURL(params, null),
count: ownerDataCollection.getDependentCountForLibrary(libraryUrl),
issues: {},
Expand Down Expand Up @@ -155,7 +149,6 @@ class RestfulLanguageAndIssuesDataFetcher extends BaseRestfulGithubDataFetcher<
): void {
ownerDataCollection.updateRepoData(params.owner, params.repo as string, (repoData) => {
repoData.language = languageAndOpenIssuesCount.language;
// eslint-disable-next-line @typescript-eslint/camelcase
repoData.open_issues_count = languageAndOpenIssuesCount.openIssuesCount;

return repoData;
Expand Down Expand Up @@ -188,11 +181,12 @@ class RestfulLanguageAndIssuesDataFetcher extends BaseRestfulGithubDataFetcher<
}
}

class RestfulLabelDataFetcher extends BaseRestfulGithubDataFetcher<object[]> {
public executeRequest(params: RequestParams): Promise<object[]> {
const requestUrl = `${this.getURL(params)}/issues?since=${MIN_ISSUE_DATE}&labels=${
params.label
}`;
class RestfulLabelDataFetcher extends BaseRestfulGithubDataFetcher<Record<string, unknown>[]> {
public executeRequest(params: RequestParams): Promise<Record<string, unknown>[]> {
const requestUrl =
`${this.getURL(params)}/issues?` +
`since=${MIN_ISSUE_DATE}&` +
`labels=${params.label}`;
TabDepthLogger.info(2, `Querying: ${requestUrl}`);

return this.httpClient
Expand All @@ -210,7 +204,6 @@ class RestfulLabelDataFetcher extends BaseRestfulGithubDataFetcher<object[]> {

public updateOwnerDataCollection(
params: RequestParams,
// tslint:disable-next-line: no-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
listOfIssues: any[],
ownerDataCollection: OwnerDataCollection
Expand All @@ -232,7 +225,6 @@ class RestfulLabelDataFetcher extends BaseRestfulGithubDataFetcher<object[]> {
return {
title: issue.title,
url: issue.html_url,
// eslint-disable-next-line @typescript-eslint/camelcase
created_at: issue.created_at,
tagged: [(params.label as string).replace(/\+/g, ' ')],
};
Expand Down
2 changes: 1 addition & 1 deletion src/gitHubIssueFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export class GitHubIssueFetcher {
const issueCountsAndIssues = response.search;
getLogger().info(
`Fetched: ${queryId} => ` +
`${issueCountsAndIssues.edges.length}/${issueCountsAndIssues.issueCount} (${issueCountsAndIssues.pageInfo.hasNextPage})`
`${issueCountsAndIssues.edges.length}/${issueCountsAndIssues.issueCount} (${issueCountsAndIssues.pageInfo.hasNextPage})`
);
const rateLimit = response.rateLimit;
getLogger().info(`Rate limits: ${JSON.stringify(rateLimit)}`);
Expand Down
9 changes: 0 additions & 9 deletions src/owner-data-collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,16 @@ export class OwnerDataCollection {
.split('/');
// parse owners master counts out of dependencies list
if (Object.prototype.hasOwnProperty.call(this.ownerDataMap, owner)) {
// eslint-disable-next-line @typescript-eslint/camelcase
this.ownerDataMap[owner].dependent_count += dependentCount;
} else {
this.ownersArray.push(owner);
this.ownerDataMap[owner] = {
// tslint:disable-next-line: no-null-keyword
// eslint-disable-next-line @typescript-eslint/camelcase
funding_url: null,
// eslint-disable-next-line @typescript-eslint/camelcase
html_url: 'https://github.com/' + owner,
// eslint-disable-next-line @typescript-eslint/camelcase
dependent_count: dependentCount,
// eslint-disable-next-line @typescript-eslint/camelcase
dependency_count: 1,
repos: {
[repo]: {
// tslint:disable-next-line: no-null-keyword
// eslint-disable-next-line @typescript-eslint/camelcase
funding_url: null,
count: dependentCount,
issues: {},
Expand All @@ -143,7 +135,6 @@ export class OwnerDataCollection {
};
}
const ownerData = this.ownerDataMap[owner];
// eslint-disable-next-line @typescript-eslint/camelcase
ownerData.dependency_count = Object.keys(ownerData.repos).length;
} else {
TabDepthLogger.info(0, `Not a GitHub Library. Skipping: ${libraryUrl}`);
Expand Down
3 changes: 0 additions & 3 deletions src/request-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import { TabDepthLogger } from './tab-level-logger';

export class RequesteQueueEntry {
public requestParams: RequestParams;
// tslint:disable-next-line: no-any
public dataFetcher: DataFetcher<unknown>;

// tslint:disable-next-line: no-any
constructor(requestParams: RequestParams, dataFetcher: DataFetcher<unknown>) {
this.requestParams = requestParams;
this.dataFetcher = dataFetcher;
Expand All @@ -17,7 +15,6 @@ export class RequesteQueueEntry {
export class RequestQueue {
private readonly requestQueue: OrderedMap<string, RequesteQueueEntry> = new OrderedMap();

// tslint:disable-next-line: no-any
public queueRequest(requestParams: RequestParams, dataFetcher: DataFetcher<unknown>): void {
const key = this.createKeyFromParams(requestParams);
this.requestQueue.add(key, new RequesteQueueEntry(requestParams, dataFetcher));
Expand Down

0 comments on commit c288d7c

Please sign in to comment.