Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,7 @@ export default [
allowNever: true,
},
],
'@typescript-eslint/unbound-method': [
'error',
{
ignoreStatic: true,
},
],
'@typescript-eslint/unbound-method': 'error',
},
},
{
Expand Down
16 changes: 8 additions & 8 deletions src/factories/patchFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,42 @@ export default class PatchFactory {
{
extensions: APSPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [APSPatch.FILE_SIGNATURE],
factory: APSPatch.patchFrom,
factory: APSPatch.patchFrom.bind(APSPatch),
},
{
extensions: BPSPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [BPSPatch.FILE_SIGNATURE],
factory: BPSPatch.patchFrom,
factory: BPSPatch.patchFrom.bind(BPSPatch),
},
{
extensions: DPSPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [],
factory: DPSPatch.patchFrom,
factory: DPSPatch.patchFrom.bind(DPSPatch),
},
{
extensions: IPSPatch.SUPPORTED_EXTENSIONS,
fileSignatures: IPSPatch.FILE_SIGNATURES,
factory: IPSPatch.patchFrom,
factory: IPSPatch.patchFrom.bind(IPSPatch),
},
{
extensions: NinjaPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [NinjaPatch.FILE_SIGNATURE],
factory: NinjaPatch.patchFrom,
factory: NinjaPatch.patchFrom.bind(NinjaPatch),
},
{
extensions: PPFPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [PPFPatch.FILE_SIGNATURE],
factory: PPFPatch.patchFrom,
factory: PPFPatch.patchFrom.bind(PPFPatch),
},
{
extensions: UPSPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [UPSPatch.FILE_SIGNATURE],
factory: UPSPatch.patchFrom,
factory: UPSPatch.patchFrom.bind(UPSPatch),
},
{
extensions: VcdiffPatch.SUPPORTED_EXTENSIONS,
fileSignatures: [VcdiffPatch.FILE_SIGNATURE],
factory: VcdiffPatch.patchFrom,
factory: VcdiffPatch.patchFrom.bind(VcdiffPatch),
},
];

Expand Down
70 changes: 35 additions & 35 deletions src/modules/argumentsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export default class ArgumentsParser {
choices: Object.values(ChecksumBitmask)
.filter((bitmask) => bitmask !== ChecksumBitmask.NONE)
.map((bitmask) => ChecksumBitmaskInverted[bitmask].toUpperCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: ChecksumBitmaskInverted[ChecksumBitmask.CRC32].toUpperCase(),
})
Expand All @@ -280,7 +280,7 @@ export default class ArgumentsParser {
choices: Object.values(ChecksumBitmask)
.filter((bitmask) => bitmask !== ChecksumBitmask.NONE)
.map((bitmask) => ChecksumBitmaskInverted[bitmask].toUpperCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: ChecksumBitmaskInverted[ChecksumBitmask.SHA1].toUpperCase(),
})
Expand All @@ -304,7 +304,7 @@ export default class ArgumentsParser {
description:
'Calculate checksums of archive files themselves, allowing them to match files in DATs',
choices: Object.keys(InputChecksumArchivesMode).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: InputChecksumArchivesModeInverted[InputChecksumArchivesMode.AUTO].toLowerCase(),
})
Expand Down Expand Up @@ -337,28 +337,28 @@ export default class ArgumentsParser {
group: groupDatInput,
description: 'Regular expression of DAT names to process',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})
.option('dat-name-regex-exclude', {
group: groupDatInput,
description: 'Regular expression of DAT names to exclude from processing',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})
.option('dat-description-regex', {
group: groupDatInput,
description: 'Regular expression of DAT descriptions to process',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})
.option('dat-description-regex-exclude', {
group: groupDatInput,
description: 'Regular expression of DAT descriptions to exclude from processing',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})
.option('dat-combine', {
Expand Down Expand Up @@ -432,7 +432,7 @@ export default class ArgumentsParser {
alias: 'o',
description: 'Path to the ROM output directory (supports replaceable symbols, see below)',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.middleware((middlewareArgv) => {
Expand Down Expand Up @@ -517,7 +517,7 @@ export default class ArgumentsParser {
description:
'Append the name of the game as an output subdirectory depending on how many ROMs a game has',
choices: Object.keys(GameSubdirMode).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: GameSubdirModeInverted[GameSubdirMode.MULTIPLE].toLowerCase(),
})
Expand All @@ -526,7 +526,7 @@ export default class ArgumentsParser {
description:
'Path to a JSON file of custom console token definitions to use instead of the built-in definitions',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})

Expand All @@ -535,7 +535,7 @@ export default class ArgumentsParser {
description:
'Read files for known signatures and use the correct extension (also affects dir2dat)',
choices: Object.keys(FixExtension).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: FixExtensionInverted[FixExtension.AUTO].toLowerCase(),
})
Expand Down Expand Up @@ -579,7 +579,7 @@ export default class ArgumentsParser {
group: groupRomMove,
description: 'Delete empty subdirectories from the input directories after moving ROMs',
choices: Object.keys(MoveDeleteDirs).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: MoveDeleteDirsInverted[MoveDeleteDirs.AUTO].toLowerCase(),
})
Expand All @@ -595,7 +595,7 @@ export default class ArgumentsParser {
group: groupRomClean,
description: 'Directory to move cleaned files to (instead of being recycled)',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.option('clean-dry-run', {
Expand All @@ -620,7 +620,7 @@ export default class ArgumentsParser {
group: groupRomZip,
description: 'The structure format to use for written zip files',
choices: Object.keys(ZipFormat).map((format) => format.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: ZipFormatInverted[ZipFormat.TORRENTZIP].toLowerCase(),
})
Expand All @@ -629,7 +629,7 @@ export default class ArgumentsParser {
alias: 'Z',
description: 'Glob pattern of ROM filenames to exclude from zipping',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.option('zip-dat-name', {
Expand All @@ -654,7 +654,7 @@ export default class ArgumentsParser {
group: groupRomLink,
description: 'File linking mode',
choices: Object.keys(LinkMode).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: LinkModeInverted[LinkMode.HARDLINK].toLowerCase(),
})
Expand Down Expand Up @@ -684,7 +684,7 @@ export default class ArgumentsParser {
group: groupRomHeader,
description: 'Glob pattern of input filenames to force header detection for',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.option('remove-headers', {
Expand All @@ -707,15 +707,15 @@ export default class ArgumentsParser {
description:
'Glob pattern of input filenames to force trimming detection for (overriding all options below)',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
implies: 'dat',
})
.option('trim-scan-files', {
group: groupRomTrimmed,
description: 'Detect trimming for uncompressed files',
choices: Object.keys(TrimScanFiles).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: TrimScanFilesInverted[TrimScanFiles.AUTO].toLowerCase(),
})
Expand Down Expand Up @@ -760,7 +760,7 @@ export default class ArgumentsParser {
group: groupRomSet,
description: 'ROM merge/split mode (requires DATs with parent/clone information)',
choices: Object.keys(MergeMode).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: MergeModeInverted[MergeMode.FULLNONMERGED].toLowerCase(),
})
Expand Down Expand Up @@ -803,15 +803,15 @@ export default class ArgumentsParser {
alias: 'x',
description: 'Regular expression of game names to filter to',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})
.option('filter-regex-exclude', {
group: groupRomFiltering,
alias: 'X',
description: 'Regular expression of game names to exclude',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})
.option('filter-language', {
Expand Down Expand Up @@ -858,7 +858,7 @@ export default class ArgumentsParser {
group: groupRomFiltering,
description: 'Regular expression of categories to filter to',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
implies: 'dat',
});
Expand Down Expand Up @@ -923,15 +923,15 @@ export default class ArgumentsParser {
group: groupRomPriority,
description: 'Regular expression of DAT game names to prefer',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
implies: 'single',
})
.option('prefer-rom-regex', {
group: groupRomPriority,
description: 'Regular expression of DAT ROM filenames to prefer',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
implies: 'single',
})
Expand Down Expand Up @@ -993,7 +993,7 @@ export default class ArgumentsParser {
group: groupRomPriority,
description: 'Prefer older or newer revisions, versions, or ring codes',
choices: Object.keys(PreferRevision).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
implies: 'single',
})
Expand All @@ -1014,23 +1014,23 @@ export default class ArgumentsParser {
group: groupFilePriority,
description: 'Prefer input files of a type',
choices: Object.keys(PreferFiletype).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: PreferFiletypeInverted[PreferFiletype.PLAIN].toLowerCase(),
})
.option('prefer-filename-regex', {
group: groupFilePriority,
description: 'Regular expression of filenames to prefer',
type: 'array',
coerce: ArgumentsParser.readRegexFile,
coerce: ArgumentsParser.readRegexFile.bind(ArgumentsParser),
requiresArg: true,
})

.option('playlist-mode', {
group: groupPlaylist,
description: 'Generate playlists depending on how many ROMs a game has',
choices: Object.keys(PlaylistMode).map((mode) => mode.toLowerCase()),
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: PlaylistModeInverted[PlaylistMode.MULTIPLE].toLowerCase(),
})
Expand Down Expand Up @@ -1069,7 +1069,7 @@ export default class ArgumentsParser {
group: groupDir2Dat,
description: 'dir2dat output directory',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.check((checkArgv) => {
Expand All @@ -1087,7 +1087,7 @@ export default class ArgumentsParser {
group: groupFixdat,
description: 'Fixdat output directory',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.check((checkArgv) => {
Expand All @@ -1105,7 +1105,7 @@ export default class ArgumentsParser {
group: groupReport,
description: 'Report output file location (formatted with Moment.js date/time tokens)',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
default: `${Package.NAME}_%YYYY-%MM-%DDT%HH:%mm:%ss.csv`,
})
Expand Down Expand Up @@ -1144,7 +1144,7 @@ export default class ArgumentsParser {
group: groupDirectory,
description: 'Path to a directory for temporary files',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
})
.option('disable-cache', {
Expand All @@ -1156,7 +1156,7 @@ export default class ArgumentsParser {
group: groupDirectory,
description: 'Location for the cache file',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: true,
conflicts: ['disable-cache'],
})
Expand All @@ -1171,7 +1171,7 @@ export default class ArgumentsParser {
group: groupHelpDebug,
description: 'Generate a debug log file to attach to bug reports',
type: 'string',
coerce: ArgumentsParser.getLastValue, // don't allow string[] values
coerce: ArgumentsParser.getLastValue.bind(ArgumentsParser), // don't allow string[] values
requiresArg: false, // explicitly false! we can default this
})
.middleware((middlewareArgv) => {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/candidates/candidateArchiveFileHasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class CandidateArchiveFileHasher extends Module {
const childBar = this.progressBar.addChildBar({
name: archiveFile.toString(),
total: archiveFile.getSize(),
progressFormatter: FsUtil.sizeReadable,
progressFormatter: FsUtil.sizeReadable.bind(FsUtil),
});

try {
Expand Down
Loading
Loading