Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 3d87cbc

Browse files
authored
Add comma-dangle ESLint rule (#347)
And fix some commas as a result.
1 parent 2e540e8 commit 3d87cbc

11 files changed

+23
-22
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"ArrayExpression": "first",
3333
"ignoredNodes": ["ConditionalExpression", "TemplateLiteral > *"]
3434
}],
35+
"comma-dangle": ["error", "only-multiline"],
3536
"no-constant-condition": ["error", { "checkLoops": false }],
3637
"no-useless-escape": "off",
3738
"@typescript-eslint/explicit-module-boundary-types": "off",

src/_tests/fixturedActions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { scrubDiagnosticDetails } from "../util/util";
99
import * as cachedQueries from "./cachedQueries.json";
1010
jest.mock("../util/cachedQueries", () => ({
1111
getProjectBoardColumns: jest.fn(() => cachedQueries.getProjectBoardColumns),
12-
getLabels: jest.fn(() => cachedQueries.getLabels)
12+
getLabels: jest.fn(() => cachedQueries.getLabels),
1313
}));
1414
import { executePrActions } from "../execute-pr-actions";
1515

@@ -42,7 +42,7 @@ async function testFixture(dir: string) {
4242
prInfo,
4343
(expr: string) => Promise.resolve(files[expr] as string),
4444
(name: string, _until?: Date) => name in downloads ? downloads[name] : 0,
45-
new Date(readJsonSync(derivedPath).now)
45+
new Date(readJsonSync(derivedPath).now),
4646
);
4747

4848
const action = process(derived);

src/compute-pr-actions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const LabelNames = [
4545
"Too Many Owners",
4646
"Untested Change",
4747
"Check Config",
48-
...StalenessKinds
48+
...StalenessKinds,
4949
] as const;
5050

5151
export interface Actions {
@@ -173,7 +173,7 @@ function extendPrInfo(info: PrInfo): ExtendedPrInfo {
173173
requireMaintainer, blessable, failedCI, staleness,
174174
packages, hasMultiplePackages, hasDefinitions, hasTests, isUntested, newPackages, hasNewPackages, hasEditedPackages,
175175
approvedReviews, changereqReviews, staleReviews, approvedBy, hasChangereqs,
176-
needsAuthorAction, reviewColumn, isAuthor
176+
needsAuthorAction, reviewColumn, isAuthor,
177177
};
178178

179179
// Staleness timeline configurations (except for texts that are all in `comments.ts`)
@@ -237,12 +237,12 @@ export function process(prInfo: BotResult,
237237
return {
238238
...createEmptyActions(),
239239
targetColumn: "Needs Author Action",
240-
shouldUpdateProjectColumn: true
240+
shouldUpdateProjectColumn: true,
241241
};
242242
} else {
243243
return {
244244
...createEmptyActions(),
245-
shouldRemoveFromActiveColumns: true
245+
shouldRemoveFromActiveColumns: true,
246246
};
247247
}
248248
}

src/execute-pr-actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async function getMutationsForLabels(actions: Actions, pr: PR_repository_pullReq
3636
return labels.length === 0 ? null
3737
: createMutation<schema.AddLabelsToLabelableInput & schema.RemoveLabelsFromLabelableInput>(query, {
3838
labelIds: await Promise.all(labels.map(label => getLabelIdByName(label))),
39-
labelableId: pr.id, });
39+
labelableId: pr.id });
4040
};
4141
return Promise.all([
4242
makeMutations((label => !labels.includes(label) && actions.labels.includes(label)), "addLabelsToLabelable"),
@@ -113,7 +113,7 @@ function getMutationsForChangingPRState(actions: Actions, pr: PR_repository_pull
113113
: null,
114114
actions.shouldClose
115115
? createMutation<schema.ClosePullRequestInput>("closePullRequest", { pullRequestId: pr.id })
116-
: null
116+
: null,
117117
];
118118
}
119119

src/graphql-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as schema from "@octokit/graphql-schema/schema";
55

66
const headers = {
77
authorization: `Bearer ${getAuthToken()}`,
8-
accept: "application/vnd.github.antiope-preview+json"
8+
accept: "application/vnd.github.antiope-preview+json",
99
};
1010

1111
const uri = "https://api.github.com/graphql";

src/pr-info.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PR_repository_pullRequest as GraphqlPullRequest,
66
PR_repository_pullRequest_timelineItems_nodes_ReopenedEvent,
77
PR_repository_pullRequest_timelineItems_nodes_ReadyForReviewEvent,
88
PR_repository_pullRequest_timelineItems_nodes_MovedColumnsInProjectEvent,
9-
PR_repository_pullRequest_comments_nodes
9+
PR_repository_pullRequest_comments_nodes,
1010
} from "./queries/schema/PR";
1111
import { getMonthlyDownloadCount } from "./util/npm";
1212
import { client } from "./graphql-client";
@@ -230,7 +230,7 @@ export async function deriveStateForPR(
230230
popularityLevel,
231231
pkgInfo,
232232
reviews,
233-
...getCIResult(headCommit.checkSuites)
233+
...getCIResult(headCommit.checkSuites),
234234
};
235235

236236
function botError(message: string): BotError {
@@ -354,7 +354,7 @@ const configSuspicious = <ConfigSuspicious>(async (path, getContents) => {
354354
configSuspicious["OTHER_FILES.txt"] = makeChecker(
355355
[],
356356
urls.otherFilesTxt,
357-
{ parse: text => text.split(/\r?\n/) },
357+
{ parse: text => text.split(/\r?\n/) }
358358
);
359359
configSuspicious["package.json"] = makeChecker(
360360
{ private: true },
@@ -363,7 +363,7 @@ configSuspicious["package.json"] = makeChecker(
363363
delete data.dependencies;
364364
delete data.types;
365365
delete data.typesVersions;
366-
} },
366+
} }
367367
);
368368
configSuspicious["tslint.json"] = makeChecker(
369369
{ extends: "dtslint/dt.json" },
@@ -380,7 +380,7 @@ configSuspicious["tsconfig.json"] = makeChecker(
380380
strictNullChecks: true,
381381
types: [],
382382
noEmit: true,
383-
forceConsistentCasingInFileNames: true
383+
forceConsistentCasingInFileNames: true,
384384
}
385385
},
386386
urls.tsconfigJson,
@@ -390,7 +390,7 @@ configSuspicious["tsconfig.json"] = makeChecker(
390390
delete data.compilerOptions.typeRoots;
391391
delete data.compilerOptions.paths;
392392
delete data.files;
393-
} },
393+
} }
394394
);
395395

396396
// helper for file checkers: allow either a given "expectedForm", or any edits that get closer

src/pr-trigger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export async function httpTrigger(context: Context, req: HttpRequest) {
4747
"pull_request_review": ["submitted", "dismissed"],
4848
"issue_comment": ["created", "edited", "deleted"],
4949
"project_card": ["moved"],
50-
"check_suite": ["completed"]
50+
"check_suite": ["completed"],
5151
};
5252
const allowListedActions = acceptedEventsToActions[event];
5353

src/queries/all-open-prs-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function getAllOpenPRsAndCardIDs() {
2828
const result = await client.query({
2929
query: getAllOpenPRsAndCardIDsQuery,
3030
fetchPolicy: "no-cache",
31-
variables: { endCursor }
31+
variables: { endCursor },
3232
});
3333
prNumbers.push(...noNullish(result.data.repository?.pullRequests.nodes).map(pr => pr.number));
3434
for (const pr of noNullish(result.data.repository?.pullRequests.nodes)) {

src/queries/projectboard-cards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function getProjectBoardCards() {
5555
columns.push({
5656
name: col.name,
5757
totalCount: col.cards.totalCount,
58-
cards
58+
cards,
5959
});
6060
});
6161

src/scripts/updateJSONFixtures.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ fixtureNames.forEach(fixture => {
2525
headCommit.checkSuites.nodes.push({
2626
"app": {
2727
"name": "GitHub Actions",
28-
"__typename": "App"
28+
"__typename": "App",
2929
},
3030
"conclusion": status,
3131
"resourcePath": "/DefinitelyTyped/DefinitelyTyped/commit/22c73c88cc9c09efd4c2998ec360607dd4c36c2e/checks?check_suite_id=731664306",
3232
"status": status,
3333
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/commit/22c73c88cc9c09efd4c2998ec360607dd4c36c2e/checks?check_suite_id=731664306",
34-
"__typename": "CheckSuite"
34+
"__typename": "CheckSuite",
3535
});
3636

3737
writeFileSync(responsePath, JSON.stringify(response, null, " ") + "\n", "utf8");

0 commit comments

Comments
 (0)