Skip to content

Commit e2c4552

Browse files
authored
No lint warnings; fix the one that existed (#105)
Also fix an error message with lots of whitespace.
1 parent ccb41fe commit e2c4552

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

.eslintrc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ rules:
6262
'@typescript-eslint/no-inferrable-types': 'error',
6363
'@typescript-eslint/no-misused-new': 'error',
6464
'@typescript-eslint/no-namespace': 'error',
65-
'@typescript-eslint/no-non-null-assertion': 'warn',
65+
'@typescript-eslint/no-non-null-assertion': 'error',
6666
'@typescript-eslint/no-require-imports': 'error',
6767
'@typescript-eslint/no-unnecessary-qualifier': 'error',
6868
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
6969
'@typescript-eslint/no-unused-vars': 'error',
7070
'@typescript-eslint/no-useless-constructor': 'error',
7171
'@typescript-eslint/no-var-requires': 'error',
72-
'@typescript-eslint/prefer-for-of': 'warn',
73-
'@typescript-eslint/prefer-function-type': 'warn',
72+
'@typescript-eslint/prefer-for-of': 'error',
73+
'@typescript-eslint/prefer-function-type': 'error',
7474
'@typescript-eslint/prefer-includes': 'error',
7575
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
7676
'@typescript-eslint/promise-function-async': 'error',

dist/index.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/artifactRegistry.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ export class ArtifactRegistryDockerRegistryClient {
8383
const [tag] = await this.client.getTag({ name: tagPath });
8484

8585
if (!tag || !tag.version) {
86-
throw new Error(`The tag '${tagName}' on the image '${packageName}'
87-
does not exist. Check that both the image and tag are spelled correctly.`);
86+
throw new Error(
87+
`The tag '${tagName}' on the image '${packageName}' does not exist. Check that both the image and tag are spelled correctly.`,
88+
);
8889
}
8990
// version.name is like projects/.../versions/{versionId}, but digest is in version metadata field
9091
return tag.version;

src/update-graph-artifact-refs.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,11 @@ async function checkTagsAgainstArtifactRegistryAndModifyScalars(
147147
packageName: trackable.imageName,
148148
tagName: trackable.tag,
149149
});
150-
return reference.match(/sha256:[a-f0-9]{64}/)![0]; // will always have sha256 because it is returned from OCI registry
150+
const match = reference.match(/sha256:[a-f0-9]{64}/);
151+
if (!match) {
152+
throw new Error(`Docker digest is not valid sha256: ${reference}`);
153+
}
154+
return match[0];
151155
} catch (e) {
152156
if (e instanceof Error) {
153157
let message = e.message;

0 commit comments

Comments
 (0)