fix linting
This commit is contained in:
parent
e0c4e25b76
commit
8fb3b504a0
|
@ -1,88 +1,88 @@
|
||||||
import { isLabeled } from '../functions/is-labeled';
|
import {isLabeled} from '../functions/is-labeled';
|
||||||
import { isPullRequest } from '../functions/is-pull-request';
|
import {isPullRequest} from '../functions/is-pull-request';
|
||||||
import { Assignee } from '../interfaces/assignee';
|
import {Assignee} from '../interfaces/assignee';
|
||||||
import { IIssue, OctokitIssue } from '../interfaces/issue';
|
import {IIssue, OctokitIssue} from '../interfaces/issue';
|
||||||
import { IIssuesProcessorOptions } from '../interfaces/issues-processor-options';
|
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
|
||||||
import { ILabel } from '../interfaces/label';
|
import {ILabel} from '../interfaces/label';
|
||||||
import { IMilestone } from '../interfaces/milestone';
|
import {IMilestone} from '../interfaces/milestone';
|
||||||
import { IsoDateString } from '../types/iso-date-string';
|
import {IsoDateString} from '../types/iso-date-string';
|
||||||
import { Operations } from './operations';
|
import {Operations} from './operations';
|
||||||
|
|
||||||
export class Issue implements IIssue {
|
export class Issue implements IIssue {
|
||||||
readonly title: string;
|
readonly title: string;
|
||||||
readonly number: number;
|
readonly number: number;
|
||||||
created_at: IsoDateString;
|
created_at: IsoDateString;
|
||||||
updated_at: IsoDateString;
|
updated_at: IsoDateString;
|
||||||
readonly draft: boolean;
|
readonly draft: boolean;
|
||||||
readonly labels: ILabel[];
|
readonly labels: ILabel[];
|
||||||
readonly pull_request: object | null | undefined;
|
readonly pull_request: object | null | undefined;
|
||||||
readonly state: string | 'closed' | 'open';
|
readonly state: string | 'closed' | 'open';
|
||||||
readonly locked: boolean;
|
readonly locked: boolean;
|
||||||
readonly milestone?: IMilestone | null;
|
readonly milestone?: IMilestone | null;
|
||||||
readonly assignees: Assignee[];
|
readonly assignees: Assignee[];
|
||||||
isStale: boolean;
|
isStale: boolean;
|
||||||
isRotten: boolean;
|
isRotten: boolean;
|
||||||
markedStaleThisRun: boolean;
|
markedStaleThisRun: boolean;
|
||||||
markedRottenThisRun: boolean;
|
markedRottenThisRun: boolean;
|
||||||
operations = new Operations();
|
operations = new Operations();
|
||||||
private readonly _options: IIssuesProcessorOptions;
|
private readonly _options: IIssuesProcessorOptions;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
options: Readonly<IIssuesProcessorOptions>,
|
options: Readonly<IIssuesProcessorOptions>,
|
||||||
issue: Readonly<OctokitIssue> | Readonly<IIssue>
|
issue: Readonly<OctokitIssue> | Readonly<IIssue>
|
||||||
) {
|
) {
|
||||||
this._options = options;
|
this._options = options;
|
||||||
this.title = issue.title;
|
this.title = issue.title;
|
||||||
this.number = issue.number;
|
this.number = issue.number;
|
||||||
this.created_at = issue.created_at;
|
this.created_at = issue.created_at;
|
||||||
this.updated_at = issue.updated_at;
|
this.updated_at = issue.updated_at;
|
||||||
this.draft = Boolean(issue.draft);
|
this.draft = Boolean(issue.draft);
|
||||||
this.labels = mapLabels(issue.labels);
|
this.labels = mapLabels(issue.labels);
|
||||||
this.pull_request = issue.pull_request;
|
this.pull_request = issue.pull_request;
|
||||||
this.state = issue.state;
|
this.state = issue.state;
|
||||||
this.locked = issue.locked;
|
this.locked = issue.locked;
|
||||||
this.milestone = issue.milestone;
|
this.milestone = issue.milestone;
|
||||||
this.assignees = issue.assignees || [];
|
this.assignees = issue.assignees || [];
|
||||||
this.isStale = isLabeled(this, this.staleLabel);
|
this.isStale = isLabeled(this, this.staleLabel);
|
||||||
this.isRotten = isLabeled(this, this.rottenLabel);
|
this.isRotten = isLabeled(this, this.rottenLabel);
|
||||||
this.markedStaleThisRun = false;
|
this.markedStaleThisRun = false;
|
||||||
this.markedRottenThisRun = false;
|
this.markedRottenThisRun = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isPullRequest(): boolean {
|
get isPullRequest(): boolean {
|
||||||
return isPullRequest(this);
|
return isPullRequest(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
get staleLabel(): string {
|
get staleLabel(): string {
|
||||||
return this._getStaleLabel();
|
return this._getStaleLabel();
|
||||||
}
|
}
|
||||||
get rottenLabel(): string {
|
get rottenLabel(): string {
|
||||||
return this._getRottenLabel();
|
return this._getRottenLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasAssignees(): boolean {
|
get hasAssignees(): boolean {
|
||||||
return this.assignees.length > 0;
|
return this.assignees.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getStaleLabel(): string {
|
private _getStaleLabel(): string {
|
||||||
return this.isPullRequest
|
return this.isPullRequest
|
||||||
? this._options.stalePrLabel
|
? this._options.stalePrLabel
|
||||||
: this._options.staleIssueLabel;
|
: this._options.staleIssueLabel;
|
||||||
}
|
}
|
||||||
private _getRottenLabel(): string {
|
private _getRottenLabel(): string {
|
||||||
return this.isPullRequest
|
return this.isPullRequest
|
||||||
? this._options.rottenPrLabel
|
? this._options.rottenPrLabel
|
||||||
: this._options.rottenIssueLabel;
|
: this._options.rottenIssueLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapLabels(labels: (string | ILabel)[] | ILabel[]): ILabel[] {
|
function mapLabels(labels: (string | ILabel)[] | ILabel[]): ILabel[] {
|
||||||
return labels.map(label => {
|
return labels.map(label => {
|
||||||
if (typeof label == 'string') {
|
if (typeof label == 'string') {
|
||||||
return {
|
return {
|
||||||
name: label
|
name: label
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -80,7 +80,6 @@ export class Statistics {
|
||||||
return this._incrementUndoRottenIssuesCount(increment);
|
return this._incrementUndoRottenIssuesCount(increment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
setOperationsCount(operationsCount: Readonly<number>): Statistics {
|
setOperationsCount(operationsCount: Readonly<number>): Statistics {
|
||||||
this.operationsCount = operationsCount;
|
this.operationsCount = operationsCount;
|
||||||
|
|
||||||
|
|
|
@ -55,8 +55,8 @@ export enum Option {
|
||||||
LabelsToRemoveWhenUnstale = 'labels-to-remove-when-unstale',
|
LabelsToRemoveWhenUnstale = 'labels-to-remove-when-unstale',
|
||||||
LabelsToAddWhenUnstale = 'labels-to-add-when-unstale',
|
LabelsToAddWhenUnstale = 'labels-to-add-when-unstale',
|
||||||
LabelsToRemoveWhenRotten = 'labels-to-remove-when-rotten',
|
LabelsToRemoveWhenRotten = 'labels-to-remove-when-rotten',
|
||||||
LabelsToRemoveWhenUnrotten = 'labels-to-remove-when-unstale',
|
LabelsToRemoveWhenUnrotten = 'labels-to-remove-when-unrotten',
|
||||||
LabelsToAddWhenUnrotten = 'labels-to-add-when-unstale',
|
LabelsToAddWhenUnrotten = 'labels-to-add-when-unrotten',
|
||||||
IgnoreUpdates = 'ignore-updates',
|
IgnoreUpdates = 'ignore-updates',
|
||||||
IgnoreIssueUpdates = 'ignore-issue-updates',
|
IgnoreIssueUpdates = 'ignore-issue-updates',
|
||||||
IgnorePrUpdates = 'ignore-pr-updates',
|
IgnorePrUpdates = 'ignore-pr-updates',
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
import { IsoOrRfcDateString } from '../types/iso-or-rfc-date-string';
|
import {IsoOrRfcDateString} from '../types/iso-or-rfc-date-string';
|
||||||
|
|
||||||
export interface IIssuesProcessorOptions {
|
export interface IIssuesProcessorOptions {
|
||||||
repoToken: string;
|
repoToken: string;
|
||||||
staleIssueMessage: string;
|
staleIssueMessage: string;
|
||||||
stalePrMessage: string;
|
stalePrMessage: string;
|
||||||
rottenIssueMessage: string;
|
rottenIssueMessage: string;
|
||||||
rottenPrMessage: string;
|
rottenPrMessage: string;
|
||||||
closeIssueMessage: string;
|
closeIssueMessage: string;
|
||||||
closePrMessage: string;
|
closePrMessage: string;
|
||||||
daysBeforeStale: number;
|
daysBeforeStale: number;
|
||||||
daysBeforeIssueStale: number; // Could be NaN
|
daysBeforeIssueStale: number; // Could be NaN
|
||||||
daysBeforePrStale: number; // Could be NaN
|
daysBeforePrStale: number; // Could be NaN
|
||||||
daysBeforeRotten: number;
|
daysBeforeRotten: number;
|
||||||
daysBeforeIssueRotten: number; // Could be NaN
|
daysBeforeIssueRotten: number; // Could be NaN
|
||||||
daysBeforePrRotten: number; // Could be NaN
|
daysBeforePrRotten: number; // Could be NaN
|
||||||
daysBeforeClose: number;
|
daysBeforeClose: number;
|
||||||
daysBeforeIssueClose: number; // Could be NaN
|
daysBeforeIssueClose: number; // Could be NaN
|
||||||
daysBeforePrClose: number; // Could be NaN
|
daysBeforePrClose: number; // Could be NaN
|
||||||
staleIssueLabel: string;
|
staleIssueLabel: string;
|
||||||
rottenIssueLabel: string;
|
rottenIssueLabel: string;
|
||||||
closeIssueLabel: string;
|
closeIssueLabel: string;
|
||||||
exemptIssueLabels: string;
|
exemptIssueLabels: string;
|
||||||
stalePrLabel: string;
|
stalePrLabel: string;
|
||||||
rottenPrLabel: string;
|
rottenPrLabel: string;
|
||||||
closePrLabel: string;
|
closePrLabel: string;
|
||||||
exemptPrLabels: string;
|
exemptPrLabels: string;
|
||||||
onlyLabels: string;
|
onlyLabels: string;
|
||||||
onlyIssueLabels: string;
|
onlyIssueLabels: string;
|
||||||
onlyPrLabels: string;
|
onlyPrLabels: string;
|
||||||
anyOfLabels: string;
|
anyOfLabels: string;
|
||||||
anyOfIssueLabels: string;
|
anyOfIssueLabels: string;
|
||||||
anyOfPrLabels: string;
|
anyOfPrLabels: string;
|
||||||
operationsPerRun: number;
|
operationsPerRun: number;
|
||||||
removeStaleWhenUpdated: boolean;
|
removeStaleWhenUpdated: boolean;
|
||||||
removeIssueStaleWhenUpdated: boolean | undefined;
|
removeIssueStaleWhenUpdated: boolean | undefined;
|
||||||
removePrStaleWhenUpdated: boolean | undefined;
|
removePrStaleWhenUpdated: boolean | undefined;
|
||||||
removeRottenWhenUpdated: boolean;
|
removeRottenWhenUpdated: boolean;
|
||||||
removeIssueRottenWhenUpdated: boolean | undefined;
|
removeIssueRottenWhenUpdated: boolean | undefined;
|
||||||
removePrRottenWhenUpdated: boolean | undefined;
|
removePrRottenWhenUpdated: boolean | undefined;
|
||||||
debugOnly: boolean;
|
debugOnly: boolean;
|
||||||
ascending: boolean;
|
ascending: boolean;
|
||||||
deleteBranch: boolean;
|
deleteBranch: boolean;
|
||||||
startDate: IsoOrRfcDateString | undefined; // Should be ISO 8601 or RFC 2822
|
startDate: IsoOrRfcDateString | undefined; // Should be ISO 8601 or RFC 2822
|
||||||
exemptMilestones: string;
|
exemptMilestones: string;
|
||||||
exemptIssueMilestones: string;
|
exemptIssueMilestones: string;
|
||||||
exemptPrMilestones: string;
|
exemptPrMilestones: string;
|
||||||
exemptAllMilestones: boolean;
|
exemptAllMilestones: boolean;
|
||||||
exemptAllIssueMilestones: boolean | undefined;
|
exemptAllIssueMilestones: boolean | undefined;
|
||||||
exemptAllPrMilestones: boolean | undefined;
|
exemptAllPrMilestones: boolean | undefined;
|
||||||
exemptAssignees: string;
|
exemptAssignees: string;
|
||||||
exemptIssueAssignees: string;
|
exemptIssueAssignees: string;
|
||||||
exemptPrAssignees: string;
|
exemptPrAssignees: string;
|
||||||
exemptAllAssignees: boolean;
|
exemptAllAssignees: boolean;
|
||||||
exemptAllIssueAssignees: boolean | undefined;
|
exemptAllIssueAssignees: boolean | undefined;
|
||||||
exemptAllPrAssignees: boolean | undefined;
|
exemptAllPrAssignees: boolean | undefined;
|
||||||
enableStatistics: boolean;
|
enableStatistics: boolean;
|
||||||
labelsToRemoveWhenStale: string;
|
labelsToRemoveWhenStale: string;
|
||||||
labelsToRemoveWhenUnstale: string;
|
labelsToRemoveWhenUnstale: string;
|
||||||
labelsToAddWhenUnstale: string;
|
labelsToAddWhenUnstale: string;
|
||||||
labelsToRemoveWhenRotten: string;
|
labelsToRemoveWhenRotten: string;
|
||||||
labelsToRemoveWhenUnrotten: string;
|
labelsToRemoveWhenUnrotten: string;
|
||||||
labelsToAddWhenUnrotten: string;
|
labelsToAddWhenUnrotten: string;
|
||||||
ignoreUpdates: boolean;
|
ignoreUpdates: boolean;
|
||||||
ignoreIssueUpdates: boolean | undefined;
|
ignoreIssueUpdates: boolean | undefined;
|
||||||
ignorePrUpdates: boolean | undefined;
|
ignorePrUpdates: boolean | undefined;
|
||||||
exemptDraftPr: boolean;
|
exemptDraftPr: boolean;
|
||||||
closeIssueReason: string;
|
closeIssueReason: string;
|
||||||
includeOnlyAssigned: boolean;
|
includeOnlyAssigned: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,9 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
|
||||||
),
|
),
|
||||||
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
|
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
|
||||||
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
|
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
|
||||||
daysBeforeIssueRotten: parseFloat(core.getInput('days-before-issue-rotten')),
|
daysBeforeIssueRotten: parseFloat(
|
||||||
|
core.getInput('days-before-issue-rotten')
|
||||||
|
),
|
||||||
daysBeforePrRotten: parseFloat(core.getInput('days-before-pr-rotten')),
|
daysBeforePrRotten: parseFloat(core.getInput('days-before-pr-rotten')),
|
||||||
daysBeforeClose: parseInt(
|
daysBeforeClose: parseInt(
|
||||||
core.getInput('days-before-close', {required: true})
|
core.getInput('days-before-close', {required: true})
|
||||||
|
|
Loading…
Reference in New Issue