Skip to content

Commit

Permalink
style: turn @typescript-eslint/no-unsafe-assignment rule on
Browse files Browse the repository at this point in the history
  • Loading branch information
Nipheris committed Apr 18, 2024
1 parent 09c55bb commit 7a6a03b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export default ts.config(
'@typescript-eslint/await-thenable': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',

},
},
Expand Down
5 changes: 4 additions & 1 deletion src/deb/cas.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export async function storeStream(root: string, stream: NodeJS.ReadableStream):
// compute a digest
const sha256Hash = createHash('sha256');
await pipeline(Readable.from(contentBuffer), sha256Hash);
const sha256 = sha256Hash.read();
const sha256 = sha256Hash.read() as unknown;
if (!(sha256 instanceof Buffer)) {
throw new Error('Invalid read result');
}

// store in a file
const sha256Dir = path.join(root, 'SHA256');
Expand Down
10 changes: 6 additions & 4 deletions src/deb/deb-builder.mts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class DebBuilder implements Deployer {

private async handleDeb(distribution: string, component: string, deb: Artifact): Promise<void> {
const controlTarSizeRange = { start: 120, end: 129 };
const controlTarSizeData = (await this.artifactProvider.getArtifactContent(deb, controlTarSizeRange)).read();
const controlTarSizeData = (await this.artifactProvider.getArtifactContent(deb, controlTarSizeRange)).read() as unknown;
if (!(controlTarSizeData instanceof Buffer)) {
throw new Error('Invalid read result');
}
Expand All @@ -167,10 +167,12 @@ export class DebBuilder implements Deployer {
.on('finish', () => {
const controlMetaContent = readFileSync(path.join(whereExtract, 'control'), 'utf-8').replaceAll(':', '=');
const controlMeta = ini.parse(controlMetaContent);
const name = controlMeta['Package'];
const name = controlMeta['Package'] as unknown;
assert(typeof name === 'string');
const version = controlMeta['Version'];
const arch = controlMeta['Architecture'];
const version = controlMeta['Version'] as unknown;
assert(typeof version === 'string');
const arch = controlMeta['Architecture'] as unknown;
assert(typeof arch === 'string');

const archesSet = this.archesByDistComp.get(`${distribution}/${component}`);

Expand Down

0 comments on commit 7a6a03b

Please sign in to comment.