Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update dev dependencies and react to new linting rules #611

Merged
merged 3 commits into from Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions .eslintrc.json
@@ -1,6 +1,6 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/es6"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
Expand All @@ -16,13 +16,9 @@
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-ignore": "error",
"camelcase": "off",
"@typescript-eslint/camelcase": "error",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/generic-type-naming": ["error", "^[A-Z][A-Za-z]*$"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
Expand All @@ -33,15 +29,13 @@
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-object-literal-type-assertion": "error",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-interface": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
Expand Down
336 changes: 253 additions & 83 deletions dist/index.js

Large diffs are not rendered by default.

20,606 changes: 15,351 additions & 5,255 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -34,19 +34,19 @@
"uuid": "^3.3.3"
},
"devDependencies": {
"@types/jest": "^24.0.23",
"@types/jest": "^27.0.2",
"@types/node": "^12.7.12",
"@types/uuid": "^3.4.6",
"@typescript-eslint/parser": "^2.8.0",
"@typescript-eslint/parser": "^5.1.0",
"@zeit/ncc": "^0.20.5",
"eslint": "^5.16.0",
"eslint-plugin-github": "^2.0.0",
"eslint-plugin-jest": "^22.21.0",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"eslint": "^7.32.0",
"eslint-plugin-github": "^4.3.2",
"eslint-plugin-jest": "^25.2.2",
"jest": "^27.3.0",
"jest-circus": "^27.3.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be able to delete this now

"js-yaml": "^3.13.1",
"prettier": "^1.19.1",
"ts-jest": "^24.2.0",
"typescript": "^3.6.4"
"ts-jest": "^27.0.7",
"typescript": "^4.4.4"
}
}
15 changes: 9 additions & 6 deletions src/fs-helper.ts
Expand Up @@ -9,7 +9,7 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
try {
stats = fs.statSync(path)
} catch (error) {
if (error.code === 'ENOENT') {
if ((error as any)?.code === 'ENOENT') {
if (!required) {
return false
}
Expand All @@ -18,7 +18,8 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
}

throw new Error(
`Encountered an error when checking whether path '${path}' exists: ${error.message}`
`Encountered an error when checking whether path '${path}' exists: ${(error as any)
?.message ?? error}`
)
}

Expand All @@ -39,12 +40,13 @@ export function existsSync(path: string): boolean {
try {
fs.statSync(path)
} catch (error) {
if (error.code === 'ENOENT') {
if ((error as any)?.code === 'ENOENT') {
return false
}

throw new Error(
`Encountered an error when checking whether path '${path}' exists: ${error.message}`
`Encountered an error when checking whether path '${path}' exists: ${(error as any)
?.message ?? error}`
)
}

Expand All @@ -60,12 +62,13 @@ export function fileExistsSync(path: string): boolean {
try {
stats = fs.statSync(path)
} catch (error) {
if (error.code === 'ENOENT') {
if ((error as any)?.code === 'ENOENT') {
return false
}

throw new Error(
`Encountered an error when checking whether path '${path}' exists: ${error.message}`
`Encountered an error when checking whether path '${path}' exists: ${(error as any)
?.message ?? error}`
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/git-auth-helper.ts
Expand Up @@ -94,7 +94,7 @@ class GitAuthHelper {
await fs.promises.stat(gitConfigPath)
configExists = true
} catch (err) {
if (err.code !== 'ENOENT') {
if ((err as any)?.code !== 'ENOENT') {
throw err
}
}
Expand Down Expand Up @@ -213,7 +213,7 @@ class GitAuthHelper {
await fs.promises.readFile(userKnownHostsPath)
).toString()
} catch (err) {
if (err.code !== 'ENOENT') {
if ((err as any)?.code !== 'ENOENT') {
throw err
}
}
Expand Down Expand Up @@ -302,7 +302,7 @@ class GitAuthHelper {
try {
await io.rmRF(keyPath)
} catch (err) {
core.debug(err.message)
core.debug(`${(err as any)?.message ?? err}`)
core.warning(`Failed to remove SSH key '${keyPath}'`)
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/git-directory-helper.ts
Expand Up @@ -39,7 +39,9 @@ export async function prepareExistingDirectory(
try {
await io.rmRF(lockPath)
} catch (error) {
core.debug(`Unable to delete '${lockPath}'. ${error.message}`)
core.debug(
`Unable to delete '${lockPath}'. ${(error as any)?.message ?? error}`
)
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/github-api-helper.ts
Expand Up @@ -92,7 +92,10 @@ export async function getDefaultBranch(
assert.ok(result, 'default_branch cannot be empty')
} catch (err) {
// Handle .wiki repo
if (err['status'] === 404 && repo.toUpperCase().endsWith('.WIKI')) {
if (
(err as any)?.status === 404 &&
repo.toUpperCase().endsWith('.WIKI')
) {
result = 'master'
}
// Otherwise error
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Expand Up @@ -24,15 +24,15 @@ async function run(): Promise<void> {
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
}
} catch (error) {
core.setFailed(error.message)
core.setFailed(`${(error as any)?.message ?? error}`)
}
}

async function cleanup(): Promise<void> {
try {
await gitSourceProvider.cleanup(stateHelper.RepositoryPath)
} catch (error) {
core.warning(error.message)
core.warning(`${(error as any)?.message ?? error}`)
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/misc/generate-docs.ts
Expand Up @@ -10,10 +10,10 @@ import * as yaml from 'js-yaml'

function updateUsage(
actionReference: string,
actionYamlPath: string = 'action.yml',
readmePath: string = 'README.md',
startToken: string = '<!-- start usage -->',
endToken: string = '<!-- end usage -->'
actionYamlPath = 'action.yml',
readmePath = 'README.md',
startToken = '<!-- start usage -->',
endToken = '<!-- end usage -->'
): void {
if (!actionReference) {
throw new Error('Parameter actionReference must not be empty')
Expand Down
4 changes: 3 additions & 1 deletion src/ref-helper.ts
Expand Up @@ -253,7 +253,9 @@ export async function checkCommitInfo(
await octokit.repos.get({owner: repositoryOwner, repo: repositoryName})
}
} catch (err) {
core.debug(`Error when validating commit info: ${err.stack}`)
core.debug(
`Error when validating commit info: ${(err as any)?.stack ?? err}`
)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/retry-helper.ts
Expand Up @@ -29,7 +29,7 @@ export class RetryHelper {
try {
return await action()
} catch (err) {
core.info(err.message)
core.info((err as any)?.message)
}

// Sleep
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Expand Up @@ -10,7 +10,8 @@
"declaration": true,
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true
"esModuleInterop": true,
"skipLibCheck": true
},
"exclude": ["__test__", "lib", "node_modules"]
}