Skip to content

Commit

Permalink
style: turn @typescript-eslint/no-unsafe-member-access rule on
Browse files Browse the repository at this point in the history
  • Loading branch information
Nipheris committed Apr 18, 2024
1 parent 85beb00 commit 572a9ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export default ts.config(
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',

},
},
Expand Down
5 changes: 4 additions & 1 deletion src/config.mts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import assert from 'node:assert';
import path from 'path';
import { pathToFileURL } from 'url';

Expand All @@ -17,7 +18,9 @@ export class ConfigProvider {

async init(): Promise<void> {
const resolvedPath = path.resolve(this.path);
this.configInstance = (await import(pathToFileURL(resolvedPath).toString())).default as Config;
const configModule = await import(pathToFileURL(resolvedPath).toString()) as unknown;
assert(typeof configModule === 'object' && configModule !== null && 'default' in configModule);
this.configInstance = configModule.default as Config;
}

get config(): Config {
Expand Down
14 changes: 9 additions & 5 deletions src/deb/deb-builder.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as path from 'node:path';
import { appendFile, writeFile } from 'node:fs/promises';
import { readdirSync, readFileSync, renameSync, unlinkSync } from 'node:fs';
import assert from 'node:assert';
import { randomBytes } from 'node:crypto';
import { Readable } from 'node:stream';

Expand Down Expand Up @@ -143,11 +144,13 @@ export class DebBuilder implements Deployer {

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

Expand Down

0 comments on commit 572a9ea

Please sign in to comment.