Skip to content

Commit 9ccf34f

Browse files
committed
package: fix usage of 'eslint-plugin-github'
Fix breakages introduced by the upgrade of the GitHub ESLint plugin from v2.0.0 to v4.6.1. This upgrade involves a few breaking changes, namely the removal of 'github/es6' (deprecated as of v4.0.0 [1]) in favor of 'github/recommended'. Update ESLint rules as 'actions/typescript-action' did in a similar upgrade (see [2] and [3]). Finally, run 'eslint --fix src/**/*.ts' to clean up any outstanding issues. [1] https://github.com/github/eslint-plugin-github/releases/tag/v4.0.0-0 [2] actions/typescript-action#62 [3] actions/typescript-action@d3152badbbdc2 Signed-off-by: Victoria Dye <[email protected]>
1 parent 892ee8a commit 9ccf34f

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

.eslintrc.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"plugins": ["jest", "@typescript-eslint"],
3-
"extends": ["plugin:github/es6"],
3+
"extends": ["plugin:github/recommended"],
44
"parser": "@typescript-eslint/parser",
55
"parserOptions": {
66
"ecmaVersion": 9,
77
"sourceType": "module",
88
"project": "./tsconfig.json"
99
},
1010
"rules": {
11+
"i18n-text/no-en": "off",
1112
"eslint-comments/no-use": "off",
1213
"import/no-namespace": "off",
1314
"no-unused-vars": "off",
@@ -16,13 +17,10 @@
1617
"@typescript-eslint/no-require-imports": "error",
1718
"@typescript-eslint/array-type": "error",
1819
"@typescript-eslint/await-thenable": "error",
19-
"@typescript-eslint/ban-ts-ignore": "error",
20+
"@typescript-eslint/ban-ts-comment": "error",
2021
"camelcase": "off",
21-
"@typescript-eslint/camelcase": "error",
22-
"@typescript-eslint/class-name-casing": "error",
2322
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
2423
"@typescript-eslint/func-call-spacing": ["error", "never"],
25-
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
2624
"@typescript-eslint/no-array-constructor": "error",
2725
"@typescript-eslint/no-empty-interface": "error",
2826
"@typescript-eslint/no-explicit-any": "error",
@@ -32,15 +30,14 @@
3230
"@typescript-eslint/no-misused-new": "error",
3331
"@typescript-eslint/no-namespace": "error",
3432
"@typescript-eslint/no-non-null-assertion": "warn",
35-
"@typescript-eslint/no-object-literal-type-assertion": "error",
33+
"@typescript-eslint/consistent-type-assertions": "error",
3634
"@typescript-eslint/no-unnecessary-qualifier": "error",
3735
"@typescript-eslint/no-unnecessary-type-assertion": "error",
3836
"@typescript-eslint/no-useless-constructor": "error",
3937
"@typescript-eslint/no-var-requires": "error",
4038
"@typescript-eslint/prefer-for-of": "warn",
4139
"@typescript-eslint/prefer-function-type": "warn",
4240
"@typescript-eslint/prefer-includes": "error",
43-
"@typescript-eslint/prefer-interface": "error",
4441
"@typescript-eslint/prefer-string-starts-ends-with": "error",
4542
"@typescript-eslint/promise-function-async": "error",
4643
"@typescript-eslint/require-array-sort-compare": "error",
@@ -55,4 +52,4 @@
5552
"es6": true,
5653
"jest/globals": true
5754
}
58-
}
55+
}

src/git.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ export class Repository {
104104
);
105105
}
106106

107-
static splitRepoName(
108-
ownerAndName: string
109-
): { owner: string; repoName: string } {
107+
static splitRepoName(ownerAndName: string): {
108+
owner: string;
109+
repoName: string;
110+
} {
110111
const nameParts = ownerAndName.split('/');
111112
if (nameParts.length !== 2) {
112113
throw new Error(`invalid repo name '${ownerAndName}'`);
@@ -127,8 +128,9 @@ export class Repository {
127128

128129
assertOk(
129130
status,
130-
`failed to download '${filePath}' @ '${branch ||
131-
this.defaultBranch.name}' from '${this.owner}/${this.name}'`
131+
`failed to download '${filePath}' @ '${
132+
branch || this.defaultBranch.name
133+
}' from '${this.owner}/${this.name}'`
132134
);
133135

134136
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -146,14 +148,15 @@ export class Repository {
146148
message: string,
147149
existingBlob?: string
148150
): Promise<Commit> {
149-
const { status, data } = await this.api.rest.repos.createOrUpdateFileContents({
150-
...this.req,
151-
content: Buffer.from(content).toString('base64'),
152-
branch,
153-
path: filePath,
154-
message,
155-
sha: existingBlob
156-
});
151+
const { status, data } =
152+
await this.api.rest.repos.createOrUpdateFileContents({
153+
...this.req,
154+
content: Buffer.from(content).toString('base64'),
155+
branch,
156+
path: filePath,
157+
message,
158+
sha: existingBlob
159+
});
157160

158161
assertOk(
159162
status,

src/homebrew.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export class Package {
77
readonly gitBlob: string | undefined;
88
content: string;
99

10-
/* eslint-disable no-dupe-class-members */
1110
constructor(gitFile: Git.File);
1211
constructor(filePath: string, content: string);
1312
constructor(pathOrGitFile: string | Git.File, content?: string) {
@@ -22,7 +21,6 @@ export class Package {
2221

2322
this.originalContent = this.content;
2423
}
25-
/* eslint-enable no-dupe-class-members */
2624

2725
isDirty(): boolean {
2826
return this.originalContent !== this.content;
@@ -37,7 +35,7 @@ export class Package {
3735
return match ? match[3] : '';
3836
}
3937

40-
setField(name: string, value: string, instance: number = 0): void {
38+
setField(name: string, value: string, instance = 0): void {
4139
let tracker = 0;
4240
this.content = this.content.replace(
4341
this.getFieldRegex(name),

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async function run(): Promise<void> {
231231
if (error instanceof Error) {
232232
core.setFailed(error);
233233
} else {
234-
core.setFailed(`Unknown error occurred.`)
234+
core.setFailed(`Unknown error occurred.`);
235235
}
236236
}
237237
}

0 commit comments

Comments
 (0)