From 27e0422a696aa9d4f0cb253571d919500facce10 Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 10 Aug 2024 18:36:44 -0400 Subject: [PATCH] Eslint 9 native config --- eslint.config.mjs | 95 +++---- src/craiIndex.ts | 139 +++++----- src/cramFile/codecs/byteArrayLength.ts | 11 +- src/cramFile/codecs/byteArrayStop.ts | 12 - src/cramFile/codecs/external.ts | 3 +- src/cramFile/codecs/getBits.ts | 2 +- src/cramFile/codecs/huffman.ts | 23 +- src/cramFile/container/compressionScheme.ts | 69 ++--- src/cramFile/container/index.ts | 4 +- src/cramFile/file.ts | 12 +- src/cramFile/record.ts | 13 +- src/cramFile/sectionParsers.ts | 8 +- src/cramFile/slice/decodeRecord.ts | 39 ++- src/cramFile/slice/index.ts | 39 ++- src/cramFile/util.ts | 71 ++--- src/indexedCramFile.ts | 5 +- src/rans/d04.ts | 2 +- src/rans/d14.ts | 2 +- src/rans/decoding.ts | 2 +- src/rans/frequencies.ts | 2 +- src/rans/index.ts | 2 +- test/compressions.test.ts | 2 +- test/crai.test.ts | 4 +- test/cram2sam.ts | 50 ++-- test/data/set_seqs.js | 118 --------- test/dump1.test.ts | 2 +- test/dump2.test.ts | 2 +- test/indexedfile.test.ts | 28 +- test/lib/dumpFile.ts | 2 +- test/lib/fasta/index.ts | 2 +- test/lib/syncLocalFile.ts | 4 +- test/lossy-names.test.ts | 2 +- test/parse.test.ts | 2 +- test/retry.test.ts | 4 +- test/util.test.ts | 2 +- yarn.lock | 279 ++++++++------------ 36 files changed, 433 insertions(+), 625 deletions(-) delete mode 100644 test/data/set_seqs.js diff --git a/eslint.config.mjs b/eslint.config.mjs index 1d375ed7..62e31818 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,63 +1,45 @@ -import prettier from 'eslint-plugin-prettier' -import typescriptEslint from '@typescript-eslint/eslint-plugin' -import tsParser from '@typescript-eslint/parser' -import path from 'node:path' -import { fileURLToPath } from 'node:url' -import js from '@eslint/js' -import { FlatCompat } from '@eslint/eslintrc' +import eslint from '@eslint/js' +import eslintPluginUnicorn from 'eslint-plugin-unicorn' +import tseslint from 'typescript-eslint' -const __filename = fileURLToPath(import.meta.url) -const __dirname = path.dirname(__filename) -const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all, -}) - -export default [ - ...compat.extends( - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-type-checked', - 'plugin:@typescript-eslint/stylistic-type-checked', - 'plugin:prettier/recommended', - 'plugin:unicorn/recommended', - ), +export default tseslint.config( + { + ignores: ['esm/**/*', 'dist/**/*', '*.js', '*.mjs', 'example/*'], + }, { - plugins: { - prettier, - '@typescript-eslint': typescriptEslint, - }, - languageOptions: { - parser: tsParser, - ecmaVersion: 5, - sourceType: 'script', - parserOptions: { - project: './tsconfig.lint.json', + project: ['./tsconfig.lint.json'], + tsconfigRootDir: import.meta.dirname, }, }, - + }, + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...tseslint.configs.stylisticTypeChecked, + ...tseslint.configs.strictTypeChecked, + eslintPluginUnicorn.configs['flat/recommended'], + { rules: { - '@typescript-eslint/no-unused-vars': [ - 'warn', - { - argsIgnorePattern: '^_', - ignoreRestSiblings: true, - }, - ], + 'no-empty': 'off', 'no-console': [ 'warn', { allow: ['error', 'warn'], }, ], - 'no-underscore-dangle': 0, + 'no-underscore-dangle': 'off', curly: 'error', - '@typescript-eslint/no-explicit-any': 0, - '@typescript-eslint/explicit-module-boundary-types': 0, - '@typescript-eslint/ban-ts-comment': 0, semi: ['error', 'never'], + 'spaced-comment': [ + 'error', + 'always', + { + markers: ['/'], + }, + ], + + 'unicorn/prefer-structured-clone': 'off', 'unicorn/no-new-array': 'off', 'unicorn/no-empty-file': 'off', 'unicorn/prefer-type-error': 'off', @@ -101,15 +83,36 @@ export default [ 'unicorn/prefer-at': 'off', 'unicorn/prefer-string-replace-all': 'off', 'unicorn/no-array-reduce': 'off', + + '@typescript-eslint/no-deprecated': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-unnecessary-type-parameters': 'off', + '@typescript-eslint/no-misused-promises': 'off', '@typescript-eslint/no-base-to-string': 'off', '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-argument': 'off', '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', '@typescript-eslint/no-unsafe-call': 'off', '@typescript-eslint/no-unsafe-return': 'off', '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/require-await': 'off', '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-extraneous-class': 'off', + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/no-dynamic-delete': 'off', + '@typescript-eslint/no-unused-vars': [ + 'warn', + { + argsIgnorePattern: '^_', + ignoreRestSiblings: true, + caughtErrors: 'none', + }, + ], }, }, -] +) diff --git a/src/craiIndex.ts b/src/craiIndex.ts index dc294de0..15b34da1 100644 --- a/src/craiIndex.ts +++ b/src/craiIndex.ts @@ -6,7 +6,7 @@ import { CramMalformedError } from './errors' import { CramFileSource } from './cramFile/file' import { Filehandle } from './cramFile/filehandle' -const BAI_MAGIC = 21578050 // BAI\1 +const BAI_MAGIC = 21_578_050 // BAI\1 export interface Slice { start: number @@ -16,33 +16,38 @@ export interface Slice { sliceBytes: number } -type ParsedIndex = Record +type ParsedIndex = Record function addRecordToIndex(index: ParsedIndex, record: number[]) { const [seqId, start, span, containerStart, sliceStart, sliceBytes] = record - if (!index[seqId]) { - index[seqId] = [] + const s = seqId! + if (!index[s]) { + index[s] = [] } - index[seqId].push({ - start, - span, - containerStart, - sliceStart, - sliceBytes, + index[s].push({ + start: start!, + span: span!, + containerStart: containerStart!, + sliceStart: sliceStart!, + sliceBytes: sliceBytes!, }) } export default class CraiIndex { - // A CRAM index (.crai) is a gzipped tab delimited file containing the following columns: + // A CRAM index (.crai) is a gzipped tab delimited file containing the + // following columns: + // // 1. Sequence id // 2. Alignment start // 3. Alignment span // 4. Container start byte position in the file // 5. Slice start byte position in the container data (‘blocks’) // 6. Slice size in bytes - // Each line represents a slice in the CRAM file. Please note that all slices must be listed in index file. + // + // Each line represents a slice in the CRAM file. Please note that all slices + // must be listed in index file. private _parseCache: AbortablePromiseCache private filehandle: Filehandle @@ -61,68 +66,60 @@ export default class CraiIndex { }) } - parseIndex() { + async parseIndex() { const index: ParsedIndex = {} - return this.filehandle - .readFile() - .then(data => { - if (data[0] === 31 && data[1] === 139) { - return unzip(data) - } - return data - }) - .then(uncompressedBuffer => { - if ( - uncompressedBuffer.length > 4 && - uncompressedBuffer.readUInt32LE(0) === BAI_MAGIC - ) { - throw new CramMalformedError( - 'invalid .crai index file. note: file appears to be a .bai index. this is technically legal but please open a github issue if you need support', - ) - } - // interpret the text as regular ascii, since it is - // supposed to be only digits and whitespace characters - // this is written in a deliberately low-level fashion for performance, - // because some .crai files can be pretty large. - let currentRecord: number[] = [] - let currentString = '' - for (const charCode of uncompressedBuffer) { - if ( - (charCode >= 48 && charCode <= 57) /* 0-9 */ || - (!currentString && charCode === 45) /* leading - */ - ) { - currentString += String.fromCharCode(charCode) - } else if (charCode === 9 /* \t */) { - currentRecord.push(Number.parseInt(currentString, 10)) - currentString = '' - } else if (charCode === 10 /* \n */) { - currentRecord.push(Number.parseInt(currentString, 10)) - currentString = '' - addRecordToIndex(index, currentRecord) - currentRecord = [] - } else if (charCode !== 13 /* \r */ && charCode !== 32 /* space */) { - // if there are other characters in the file besides - // space and \r, something is wrong. - throw new CramMalformedError('invalid .crai index file') - } - } + const data = await this.filehandle.readFile() + const uncompressedBuffer = + data[0] === 31 && data[1] === 139 ? unzip(data) : data + if ( + uncompressedBuffer.length > 4 && + uncompressedBuffer.readUInt32LE(0) === BAI_MAGIC + ) { + throw new CramMalformedError( + 'invalid .crai index file. note: file appears to be a .bai index. this is technically legal but please open a github issue if you need support', + ) + } + // interpret the text as regular ascii, since it is + // supposed to be only digits and whitespace characters + // this is written in a deliberately low-level fashion for performance, + // because some .crai files can be pretty large. + let currentRecord: number[] = [] + let currentString = '' + for (const charCode of uncompressedBuffer) { + if ( + (charCode >= 48 && charCode <= 57) /* 0-9 */ || + (!currentString && charCode === 45) /* leading - */ + ) { + currentString += String.fromCharCode(charCode) + } else if (charCode === 9 /* \t */) { + currentRecord.push(Number.parseInt(currentString, 10)) + currentString = '' + } else if (charCode === 10 /* \n */) { + currentRecord.push(Number.parseInt(currentString, 10)) + currentString = '' + addRecordToIndex(index, currentRecord) + currentRecord = [] + } else if (charCode !== 13 /* \r */ && charCode !== 32 /* space */) { + // if there are other characters in the file besides + // space and \r, something is wrong. + throw new CramMalformedError('invalid .crai index file') + } + } - // if the file ends without a \n, we need to flush our buffers - if (currentString) { - currentRecord.push(Number.parseInt(currentString, 10)) - } - if (currentRecord.length === 6) { - addRecordToIndex(index, currentRecord) - } + // if the file ends without a \n, we need to flush our buffers + if (currentString) { + currentRecord.push(Number.parseInt(currentString, 10)) + } + if (currentRecord.length === 6) { + addRecordToIndex(index, currentRecord) + } - // sort each of them by start - Object.entries(index).forEach(([seqId, ent]) => { - index[seqId] = ent.sort( - (a, b) => a.start - b.start || a.span - b.span, - ) - }) - return index - }) + // sort each of them by start + Object.entries(index).forEach(([seqId, ent]) => { + const e2 = ent! + index[seqId] = e2.sort((a, b) => a.start - b.start || a.span - b.span) + }) + return index } getIndex(opts: { signal?: AbortSignal } = {}) { diff --git a/src/cramFile/codecs/byteArrayLength.ts b/src/cramFile/codecs/byteArrayLength.ts index 4951e341..fb7d69ae 100644 --- a/src/cramFile/codecs/byteArrayLength.ts +++ b/src/cramFile/codecs/byteArrayLength.ts @@ -23,11 +23,6 @@ export default class ByteArrayStopCodec extends CramCodec< ) { super(parameters, dataType) this.instantiateCodec = instantiateCodec - if (dataType !== 'byteArray') { - throw new TypeError( - `byteArrayLength does not support data type ${dataType}`, - ) - } } decode( @@ -71,6 +66,6 @@ export default class ByteArrayStopCodec extends CramCodec< } } -'_getLengthCodec _getDataCodec' - .split(' ') - .forEach(method => tinyMemoize(ByteArrayStopCodec, method)) +'_getLengthCodec _getDataCodec'.split(' ').forEach(method => { + tinyMemoize(ByteArrayStopCodec, method) +}) diff --git a/src/cramFile/codecs/byteArrayStop.ts b/src/cramFile/codecs/byteArrayStop.ts index 2495e1cc..7f0a494b 100644 --- a/src/cramFile/codecs/byteArrayStop.ts +++ b/src/cramFile/codecs/byteArrayStop.ts @@ -10,18 +10,6 @@ export default class ByteArrayStopCodec extends CramCodec< 'byteArray', ByteArrayStopCramEncoding['parameters'] > { - constructor( - parameters: ByteArrayStopCramEncoding['parameters'], - dataType: 'byteArray', - ) { - super(parameters, dataType) - if (dataType !== 'byteArray') { - throw new TypeError( - `byteArrayStop codec does not support data type ${dataType}`, - ) - } - } - decode( slice: CramSlice, coreDataBlock: CramFileBlock, diff --git a/src/cramFile/codecs/external.ts b/src/cramFile/codecs/external.ts index 672e41ff..9f818086 100644 --- a/src/cramFile/codecs/external.ts +++ b/src/cramFile/codecs/external.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/unbound-method */ import { CramMalformedError, CramUnimplementedError } from '../../errors' import CramCodec, { Cursor, Cursors } from './_base' import { parseItf8 } from '../util' @@ -64,6 +63,6 @@ export default class ExternalCodec extends CramCodec< 'attempted to read beyond end of block. this file seems truncated.', ) } - return contentBlock.content[cursor.bytePosition++] + return contentBlock.content[cursor.bytePosition++]! } } diff --git a/src/cramFile/codecs/getBits.ts b/src/cramFile/codecs/getBits.ts index 4edf95db..18c3f386 100644 --- a/src/cramFile/codecs/getBits.ts +++ b/src/cramFile/codecs/getBits.ts @@ -17,7 +17,7 @@ export function getBits( for (let dlen = numBits; dlen; dlen--) { // get the next `dlen` bits in the input, put them in val val <<= 1 - val |= (data[cursor.bytePosition] >> cursor.bitPosition) & 1 + val |= (data[cursor.bytePosition]! >> cursor.bitPosition) & 1 cursor.bitPosition -= 1 if (cursor.bitPosition < 0) { cursor.bytePosition += 1 diff --git a/src/cramFile/codecs/huffman.ts b/src/cramFile/codecs/huffman.ts index 159ee9ae..632ebba9 100644 --- a/src/cramFile/codecs/huffman.ts +++ b/src/cramFile/codecs/huffman.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/unbound-method */ import { CramMalformedError } from '../../errors' import CramCodec, { Cursor, Cursors } from './_base' import { getBits } from './getBits' @@ -48,7 +47,7 @@ export default class HuffmanIntCodec extends CramCodec< // if this is a degenerate zero-length huffman code, special-case the // decoding - if (this.sortedCodes[0].bitLength === 0) { + if (this.sortedCodes[0]!.bitLength === 0) { this._decode = this._decodeZeroLengthCode } } @@ -58,10 +57,10 @@ export default class HuffmanIntCodec extends CramCodec< let codes = new Array<{ symbol: number; bitLength: number }>( this.parameters.numCodes, ) - for (let i = 0; i < this.parameters.numCodes; i += 1) { + for (let i = 0; i < this.parameters.numCodes; i++) { codes[i] = { - symbol: this.parameters.symbols[i], - bitLength: this.parameters.bitLengths[i], + symbol: this.parameters.symbols[i]!, + bitLength: this.parameters.bitLengths[i]!, } } // sort the codes by bit length and symbol value @@ -74,7 +73,7 @@ export default class HuffmanIntCodec extends CramCodec< if (!this.codeBook[code.bitLength]) { this.codeBook[code.bitLength] = [] } - this.codeBook[code.bitLength].push(code.symbol) + this.codeBook[code.bitLength]!.push(code.symbol) }) } @@ -117,7 +116,7 @@ export default class HuffmanIntCodec extends CramCodec< this.bitCodeToValue = new Array(maxBitCode + 1).fill(-1) for (let i = 0; i < this.sortedBitCodes.length; i += 1) { - this.bitCodeToValue[this.sortedCodes[i].bitCode] = i + this.bitCodeToValue[this.sortedCodes[i]!.bitCode] = i } } @@ -136,7 +135,7 @@ export default class HuffmanIntCodec extends CramCodec< // the special case for zero-length codes _decodeZeroLengthCode() { - return this.sortedCodes[0].value + return this.sortedCodes[0]!.value } _decode(slice: CramSlice, coreDataBlock: CramFileBlock, coreCursor: Cursor) { @@ -145,19 +144,19 @@ export default class HuffmanIntCodec extends CramCodec< let prevLen = 0 let bits = 0 for (let i = 0; i < this.sortedCodes.length; i += 1) { - const length = this.sortedCodes[i].bitLength + const length = this.sortedCodes[i]!.bitLength bits <<= length - prevLen bits |= getBits(input, coreCursor, length - prevLen) prevLen = length { - const index = this.bitCodeToValue[bits] + const index = this.bitCodeToValue[bits]! if (index > -1 && this.sortedBitLengthsByBitCode[index] === length) { - return this.sortedValuesByBitCode[index] + return this.sortedValuesByBitCode[index]! } for ( let j = i; - this.sortedCodes[j + 1].bitLength === length && + this.sortedCodes[j + 1]!.bitLength === length && j < this.sortedCodes.length; j += 1 ) { diff --git a/src/cramFile/container/compressionScheme.ts b/src/cramFile/container/compressionScheme.ts index a73f109f..a4b0781a 100644 --- a/src/cramFile/container/compressionScheme.ts +++ b/src/cramFile/container/compressionScheme.ts @@ -53,30 +53,30 @@ function parseSubstitutionMatrix(byteArray: number[]) { matrix[i] = new Array(4) } - matrix[0][(byteArray[0] >> 6) & 3] = 'C' - matrix[0][(byteArray[0] >> 4) & 3] = 'G' - matrix[0][(byteArray[0] >> 2) & 3] = 'T' - matrix[0][(byteArray[0] >> 0) & 3] = 'N' - - matrix[1][(byteArray[1] >> 6) & 3] = 'A' - matrix[1][(byteArray[1] >> 4) & 3] = 'G' - matrix[1][(byteArray[1] >> 2) & 3] = 'T' - matrix[1][(byteArray[1] >> 0) & 3] = 'N' - - matrix[2][(byteArray[2] >> 6) & 3] = 'A' - matrix[2][(byteArray[2] >> 4) & 3] = 'C' - matrix[2][(byteArray[2] >> 2) & 3] = 'T' - matrix[2][(byteArray[2] >> 0) & 3] = 'N' - - matrix[3][(byteArray[3] >> 6) & 3] = 'A' - matrix[3][(byteArray[3] >> 4) & 3] = 'C' - matrix[3][(byteArray[3] >> 2) & 3] = 'G' - matrix[3][(byteArray[3] >> 0) & 3] = 'N' - - matrix[4][(byteArray[4] >> 6) & 3] = 'A' - matrix[4][(byteArray[4] >> 4) & 3] = 'C' - matrix[4][(byteArray[4] >> 2) & 3] = 'G' - matrix[4][(byteArray[4] >> 0) & 3] = 'T' + matrix[0]![(byteArray[0]! >> 6) & 3] = 'C' + matrix[0]![(byteArray[0]! >> 4) & 3] = 'G' + matrix[0]![(byteArray[0]! >> 2) & 3] = 'T' + matrix[0]![(byteArray[0]! >> 0) & 3] = 'N' + + matrix[1]![(byteArray[1]! >> 6) & 3] = 'A' + matrix[1]![(byteArray[1]! >> 4) & 3] = 'G' + matrix[1]![(byteArray[1]! >> 2) & 3] = 'T' + matrix[1]![(byteArray[1]! >> 0) & 3] = 'N' + + matrix[2]![(byteArray[2]! >> 6) & 3] = 'A' + matrix[2]![(byteArray[2]! >> 4) & 3] = 'C' + matrix[2]![(byteArray[2]! >> 2) & 3] = 'T' + matrix[2]![(byteArray[2]! >> 0) & 3] = 'N' + + matrix[3]![(byteArray[3]! >> 6) & 3] = 'A' + matrix[3]![(byteArray[3]! >> 4) & 3] = 'C' + matrix[3]![(byteArray[3]! >> 2) & 3] = 'G' + matrix[3]![(byteArray[3]! >> 0) & 3] = 'N' + + matrix[4]![(byteArray[4]! >> 6) & 3] = 'A' + matrix[4]![(byteArray[4]! >> 4) & 3] = 'C' + matrix[4]![(byteArray[4]! >> 2) & 3] = 'G' + matrix[4]![(byteArray[4]! >> 0) & 3] = 'T' return matrix } @@ -112,16 +112,21 @@ export default class CramContainerCompressionScheme { * @private */ getCodecForTag(tagName: string): CramCodec { - if (!this.tagCodecCache[tagName]) { + const test = this.tagCodecCache[tagName] + if (!test) { const encodingData = this.tagEncoding[tagName] - if (encodingData) { - this.tagCodecCache[tagName] = instantiateCodec( - encodingData, - 'byteArray', // all tags are byte array data - ) + if (!encodingData) { + throw new Error('Error, no tag encoding') } + const ret = instantiateCodec( + encodingData, + 'byteArray', // all tags are byte array data + ) + this.tagCodecCache[tagName] = ret + return ret + } else { + return test } - return this.tagCodecCache[tagName] } /** @@ -140,8 +145,10 @@ export default class CramContainerCompressionScheme { this.dataSeriesCodecCache[dataSeriesName] if (r === undefined) { const encodingData = this.dataSeriesEncoding[dataSeriesName] + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (encodingData) { const dataType = dataSeriesTypes[dataSeriesName] + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!dataType) { throw new CramMalformedError( `data series name ${dataSeriesName} not defined in file compression header`, diff --git a/src/cramFile/container/index.ts b/src/cramFile/container/index.ts index b5d3717e..7af509e2 100644 --- a/src/cramFile/container/index.ts +++ b/src/cramFile/container/index.ts @@ -130,4 +130,6 @@ export default class CramContainer { 'getHeader getCompressionHeaderBlock getCompressionScheme' .split(' ') - .forEach(method => tinyMemoize(CramContainer, method)) + .forEach(method => { + tinyMemoize(CramContainer, method) + }) diff --git a/src/cramFile/file.ts b/src/cramFile/file.ts index 6ff39f52..eb509a8a 100644 --- a/src/cramFile/file.ts +++ b/src/cramFile/file.ts @@ -279,7 +279,7 @@ export default class CramFile { }, position: number, size = section.maxLength, - preReadBuffer = undefined, + preReadBuffer?: Buffer, ) { let buffer: Buffer if (preReadBuffer) { @@ -330,8 +330,8 @@ export default class CramFile { ret.copy(outputBuffer) } else if (compressionMethod === 'rans') { ransuncompress(inputBuffer, outputBuffer) - //htscodecs r4x8 is slower, but compatible. - //htscodecs.r4x8_uncompress(inputBuffer, outputBuffer); + // htscodecs r4x8 is slower, but compatible. + // htscodecs.r4x8_uncompress(inputBuffer, outputBuffer); } else if (compressionMethod === 'rans4x16') { htscodecs.r4x16_uncompress(inputBuffer, outputBuffer) } else if (compressionMethod === 'arith') { @@ -422,6 +422,6 @@ export default class CramFile { } } -'getDefinition getSectionParsers getSamHeader' - .split(' ') - .forEach(method => tinyMemoize(CramFile, method)) +'getDefinition getSectionParsers getSamHeader'.split(' ').forEach(method => { + tinyMemoize(CramFile, method) +}) diff --git a/src/cramFile/record.ts b/src/cramFile/record.ts index 9b7f75ae..442f8856 100644 --- a/src/cramFile/record.ts +++ b/src/cramFile/record.ts @@ -42,7 +42,7 @@ function decodeReadSequence(cramRecord: CramRecord, refRegion: RefRegion) { let currentReadFeature = 0 while (bases.length < cramRecord.readLength) { if (currentReadFeature < cramRecord.readFeatures.length) { - const feature = cramRecord.readFeatures[currentReadFeature] + const feature = cramRecord.readFeatures[currentReadFeature]! if (feature.code === 'Q' || feature.code === 'q') { currentReadFeature += 1 } else if (feature.pos === bases.length + 1) { @@ -90,10 +90,7 @@ function decodeReadSequence(cramRecord: CramRecord, refRegion: RefRegion) { // put down a chunk of sequence up to the next read feature const chunk = refRegion.seq.slice( regionPos, - regionPos + - cramRecord.readFeatures[currentReadFeature].pos - - bases.length - - 1, + regionPos + feature.pos - bases.length - 1, ) bases += chunk regionPos += chunk.length @@ -131,10 +128,6 @@ function decodeBaseSubstitution( compressionScheme: CramContainerCompressionScheme, readFeature: ReadFeature, ) { - if (!refRegion) { - return - } - // decode base substitution code using the substitution matrix const refCoord = readFeature.refPos - refRegion.start const refBase = refRegion.seq.charAt(refCoord) @@ -145,7 +138,7 @@ function decodeBaseSubstitution( if (baseNumber === undefined) { baseNumber = 4 } - const substitutionScheme = compressionScheme.substitutionMatrix[baseNumber] + const substitutionScheme = compressionScheme.substitutionMatrix[baseNumber]! const base = substitutionScheme[readFeature.data] if (base) { readFeature.sub = base diff --git a/src/cramFile/sectionParsers.ts b/src/cramFile/sectionParsers.ts index f9eeb1fe..d8dc3022 100644 --- a/src/cramFile/sectionParsers.ts +++ b/src/cramFile/sectionParsers.ts @@ -179,8 +179,8 @@ export function cramPreservationMap() { const ents = [] for (let i = 0; i < mapCount; i++) { const key = - String.fromCharCode(buffer[offset]) + - String.fromCharCode(buffer[offset + 1]) + String.fromCharCode(buffer[offset]!) + + String.fromCharCode(buffer[offset + 1]!) offset += 2 if ( @@ -550,8 +550,8 @@ function cramDataSeriesEncodingMap() { const ents = [] for (let i = 0; i < mapCount; i++) { const key = - String.fromCharCode(buffer[offset]) + - String.fromCharCode(buffer[offset + 1]) + String.fromCharCode(buffer[offset]!) + + String.fromCharCode(buffer[offset + 1]!) offset += 2 const { value, offset: newOffset4 } = cramEncodingSub(buffer, offset) diff --git a/src/cramFile/slice/decodeRecord.ts b/src/cramFile/slice/decodeRecord.ts index 2d542af4..59ff2dcd 100644 --- a/src/cramFile/slice/decodeRecord.ts +++ b/src/cramFile/slice/decodeRecord.ts @@ -22,7 +22,7 @@ import { DataSeriesEncodingKey } from '../codecs/dataSeriesTypes' function readNullTerminatedString(buffer: Uint8Array) { let r = '' for (let i = 0; i < buffer.length && buffer[i] !== 0; i++) { - r += String.fromCharCode(buffer[i]) + r += String.fromCharCode(buffer[i]!) } return r } @@ -32,8 +32,8 @@ function readNullTerminatedString(buffer: Uint8Array) { * @private */ function parseTagValueArray(buffer: Buffer) { - const arrayType = String.fromCharCode(buffer[0]) - const length = Int32Array.from(buffer.slice(1))[0] + const arrayType = String.fromCharCode(buffer[0]!) + const length = Int32Array.from(buffer.slice(1))[0]! const array: number[] = new Array(length) buffer = buffer.slice(5) @@ -41,37 +41,37 @@ function parseTagValueArray(buffer: Buffer) { if (arrayType === 'c') { const arr = new Int8Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else if (arrayType === 'C') { const arr = new Uint8Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else if (arrayType === 's') { const arr = new Int16Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else if (arrayType === 'S') { const arr = new Uint16Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else if (arrayType === 'i') { const arr = new Int32Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else if (arrayType === 'I') { const arr = new Uint32Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else if (arrayType === 'f') { const arr = new Float32Array(buffer.buffer) for (let i = 0; i < length; i += 1) { - array[i] = arr[i] + array[i] = arr[i]! } } else { throw new Error(`unknown type: ${arrayType}`) @@ -311,26 +311,17 @@ export default function decodeRecord( const tags: Record = {} // TN = tag names - const TN = compressionScheme.getTagNames(TLindex) + const TN = compressionScheme.getTagNames(TLindex)! const ntags = TN.length for (let i = 0; i < ntags; i += 1) { - const tagId = TN[i] + const tagId = TN[i]! const tagName = tagId.slice(0, 2) const tagType = tagId.slice(2, 3) - const tagCodec = compressionScheme.getCodecForTag(tagId) - if (!tagCodec) { - throw new CramMalformedError( - `no codec defined for auxiliary tag ${tagId}`, - ) - } - const tagData = tagCodec.decode( - slice, - coreDataBlock, - blocksByContentId, - cursors, - ) + const tagData = compressionScheme + .getCodecForTag(tagId) + .decode(slice, coreDataBlock, blocksByContentId, cursors) tags[tagName] = parseTagData(tagType, tagData) } diff --git a/src/cramFile/slice/index.ts b/src/cramFile/slice/index.ts index 5695c062..30ac40dd 100644 --- a/src/cramFile/slice/index.ts +++ b/src/cramFile/slice/index.ts @@ -90,9 +90,10 @@ function calculateIntraSliceMatePairTemplateLength( } /** - * @private establishes a mate-pair relationship between two records in the same slice. - * CRAM compresses mate-pair relationships between records in the same slice down into - * just one record having the index in the slice of its mate + * @private establishes a mate-pair relationship between two records in the + * same slice. CRAM compresses mate-pair relationships between records in the + * same slice down into just one record having the index in the slice of its + * mate */ function associateIntraSliceMate( allRecords: CramRecord[], @@ -100,12 +101,6 @@ function associateIntraSliceMate( thisRecord: CramRecord, mateRecord: CramRecord, ) { - if (!mateRecord) { - throw new CramMalformedError( - 'could not resolve intra-slice mate pairs, file seems truncated or malformed', - ) - } - const complicatedMultiSegment = !!( mateRecord.mate || (mateRecord.mateRecordNumber !== undefined && @@ -242,7 +237,7 @@ export default class CramSlice { throw new Error('block undefined') } blocks[i] = block - blockPosition = blocks[i]._endPosition + blockPosition = blocks[i]!._endPosition } return blocks @@ -251,8 +246,7 @@ export default class CramSlice { // no memoize async getCoreDataBlock() { const blocks = await this.getBlocks() - // the core data block is always the first block in the slice - return blocks[0] + return blocks[0]! } // memoize @@ -357,10 +351,6 @@ export default class CramSlice { } const sliceHeader = await this.getHeader() - if (sliceHeader === undefined) { - throw new Error('slice header undefined') - } - const blocksByContentId = await this._getBlocksContentIdIndex() // check MD5 of reference if available @@ -429,7 +419,9 @@ export default class CramSlice { ) return decoded } - let records: CramRecord[] = new Array(sliceHeader.parsedContent.numRecords) + const records: CramRecord[] = new Array( + sliceHeader.parsedContent.numRecords, + ) for (let i = 0; i < records.length; i += 1) { try { const init = decodeRecord( @@ -456,7 +448,6 @@ export default class CramSlice { console.warn( 'read attempted beyond end of buffer, file seems truncated.', ) - records = records.filter(r => !!r) break } else { throw e @@ -467,13 +458,13 @@ export default class CramSlice { // interpret `recordsToNextFragment` attributes to make standard `mate` // objects Resolve mate pair cross-references between records in this slice for (let i = 0; i < records.length; i += 1) { - const { mateRecordNumber } = records[i] + const { mateRecordNumber } = records[i]! if (mateRecordNumber !== undefined && mateRecordNumber >= 0) { associateIntraSliceMate( records, i, - records[i], - records[mateRecordNumber], + records[i]!, + records[mateRecordNumber]!, ) } } @@ -580,6 +571,6 @@ export default class CramSlice { } // memoize several methods in the class for performance -'getHeader getBlocks _getBlocksContentIdIndex' - .split(' ') - .forEach(method => tinyMemoize(CramSlice, method)) +'getHeader getBlocks _getBlocksContentIdIndex'.split(' ').forEach(method => { + tinyMemoize(CramSlice, method) +}) diff --git a/src/cramFile/util.ts b/src/cramFile/util.ts index 5b7068e0..cd476054 100644 --- a/src/cramFile/util.ts +++ b/src/cramFile/util.ts @@ -20,34 +20,34 @@ export function itf8Size(v: number) { export function parseItf8(buffer: Uint8Array, initialOffset: number) { let offset = initialOffset - const countFlags = buffer[offset] + const countFlags = buffer[offset]! let result: number if (countFlags < 0x80) { result = countFlags offset = offset + 1 } else if (countFlags < 0xc0) { - result = ((countFlags << 8) | buffer[offset + 1]) & 0x3fff + result = ((countFlags << 8) | buffer[offset + 1]!) & 0x3fff offset = offset + 2 } else if (countFlags < 0xe0) { result = - ((countFlags << 16) | (buffer[offset + 1] << 8) | buffer[offset + 2]) & + ((countFlags << 16) | (buffer[offset + 1]! << 8) | buffer[offset + 2]!) & 0x1fffff offset = offset + 3 } else if (countFlags < 0xf0) { result = ((countFlags << 24) | - (buffer[offset + 1] << 16) | - (buffer[offset + 2] << 8) | - buffer[offset + 3]) & + (buffer[offset + 1]! << 16) | + (buffer[offset + 2]! << 8) | + buffer[offset + 3]!) & 0x0fffffff offset = offset + 4 } else { result = ((countFlags & 0x0f) << 28) | - (buffer[offset + 1] << 20) | - (buffer[offset + 2] << 12) | - (buffer[offset + 3] << 4) | - (buffer[offset + 4] & 0x0f) + (buffer[offset + 1]! << 20) | + (buffer[offset + 2]! << 12) | + (buffer[offset + 3]! << 4) | + (buffer[offset + 4]! & 0x0f) // x=((0xff & 0x0f)<<28) | (0xff<<20) | (0xff<<12) | (0xff<<4) | (0x0f & 0x0f); // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1; offset = offset + 5 @@ -62,56 +62,56 @@ export function parseItf8(buffer: Uint8Array, initialOffset: number) { export function parseLtf8(buffer: Buffer, initialOffset: number) { let offset = initialOffset - const countFlags = buffer[offset] + const countFlags = buffer[offset]! let n: number | Long if (countFlags < 0x80) { n = countFlags offset += 1 } else if (countFlags < 0xc0) { - n = ((buffer[offset] << 8) | buffer[offset + 1]) & 0x3fff + n = ((buffer[offset]! << 8) | buffer[offset + 1]!) & 0x3fff offset += 2 } else if (countFlags < 0xe0) { n = - ((buffer[offset] << 16) | - (buffer[offset + 1] << 8) | - buffer[offset + 2]) & + ((buffer[offset]! << 16) | + (buffer[offset + 1]! << 8) | + buffer[offset + 2]!) & 0x1fffff n = ((countFlags & 63) << 16) | buffer.readUInt16LE(offset + 1) offset += 3 } else if (countFlags < 0xf0) { n = - ((buffer[offset] << 24) | - (buffer[offset + 1] << 16) | - (buffer[offset + 2] << 8) | - buffer[offset + 3]) & + ((buffer[offset]! << 24) | + (buffer[offset + 1]! << 16) | + (buffer[offset + 2]! << 8) | + buffer[offset + 3]!) & 0x0fffffff offset += 4 } else if (countFlags < 0xf8) { n = - ((buffer[offset] & 15) * 2 ** 32 + (buffer[offset + 1] << 24)) | - ((buffer[offset + 2] << 16) | - (buffer[offset + 3] << 8) | - buffer[offset + 4]) + ((buffer[offset]! & 15) * 2 ** 32 + (buffer[offset + 1]! << 24)) | + ((buffer[offset + 2]! << 16) | + (buffer[offset + 3]! << 8) | + buffer[offset + 4]!) // TODO *val_p = uv < 0x80000000UL ? uv : -((int32_t) (0xffffffffUL - uv)) - 1; offset += 5 } else if (countFlags < 0xfc) { n = - ((((buffer[offset] & 7) << 8) | buffer[offset + 1]) * 2 ** 32 + - (buffer[offset + 2] << 24)) | - ((buffer[offset + 3] << 16) | - (buffer[offset + 4] << 8) | - buffer[offset + 5]) + ((((buffer[offset]! & 7) << 8) | buffer[offset + 1]!) * 2 ** 32 + + (buffer[offset + 2]! << 24)) | + ((buffer[offset + 3]! << 16) | + (buffer[offset + 4]! << 8) | + buffer[offset + 5]!) offset += 6 } else if (countFlags < 0xfe) { n = - ((((buffer[offset] & 3) << 16) | - (buffer[offset + 1] << 8) | - buffer[offset + 2]) * + ((((buffer[offset]! & 3) << 16) | + (buffer[offset + 1]! << 8) | + buffer[offset + 2]!) * 2 ** 32 + - (buffer[offset + 3] << 24)) | - ((buffer[offset + 4] << 16) | - (buffer[offset + 5] << 8) | - buffer[offset + 6]) + (buffer[offset + 3]! << 24)) | + ((buffer[offset + 4]! << 16) | + (buffer[offset + 5]! << 8) | + buffer[offset + 6]!) offset += 7 } else if (countFlags < 0xff) { n = Long.fromBytesBE( @@ -167,6 +167,7 @@ export function tinyMemoize(_class: any, methodName: any) { const res = method.call(this) this[memoAttrName] = res Promise.resolve(res).catch(() => { + // eslint-disable-next-line @typescript-eslint/no-dynamic-delete delete this[memoAttrName] }) } diff --git a/src/indexedCramFile.ts b/src/indexedCramFile.ts index 28a0608c..6245274a 100644 --- a/src/indexedCramFile.ts +++ b/src/indexedCramFile.ts @@ -63,9 +63,6 @@ export default class IndexedCramFile { } this.index = args.index - if (!this.index.getEntriesForRange) { - throw new Error('invalid arguments: not an index') - } } /** @@ -163,7 +160,7 @@ export default class IndexedCramFile { .sort((a, b) => a.toString().localeCompare(b.toString())) .filter( (item, pos, ary) => - !pos || item.toString() !== ary[pos - 1].toString(), + !pos || item.toString() !== ary[pos - 1]!.toString(), ) const mateRecordPromises = [] diff --git a/src/rans/d04.ts b/src/rans/d04.ts index c664ee05..2721127a 100644 --- a/src/rans/d04.ts +++ b/src/rans/d04.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { CramMalformedError } from '../errors' import { TF_SHIFT } from './constants' diff --git a/src/rans/d14.ts b/src/rans/d14.ts index 5e49ed16..d6432dda 100644 --- a/src/rans/d14.ts +++ b/src/rans/d14.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { TF_SHIFT } from './constants' import Decoding from './decoding' diff --git a/src/rans/decoding.ts b/src/rans/decoding.ts index aafd3ee9..c3a5c359 100644 --- a/src/rans/decoding.ts +++ b/src/rans/decoding.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { CramMalformedError } from '../errors' import { RANS_BYTE_L } from './constants' diff --git a/src/rans/frequencies.ts b/src/rans/frequencies.ts index 68c3573f..05d77a99 100644 --- a/src/rans/frequencies.ts +++ b/src/rans/frequencies.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { CramMalformedError } from '../errors' import { TOTFREQ } from './constants' diff --git a/src/rans/index.ts b/src/rans/index.ts index 82c3f161..c1556a8e 100644 --- a/src/rans/index.ts +++ b/src/rans/index.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { Buffer } from 'buffer' import { CramMalformedError } from '../errors' diff --git a/test/compressions.test.ts b/test/compressions.test.ts index 18398c0d..e724339f 100644 --- a/test/compressions.test.ts +++ b/test/compressions.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { test, expect } from 'vitest' import { testDataFile } from './lib/util' import { dumpWholeFile } from './lib/dumpFile' diff --git a/test/crai.test.ts b/test/crai.test.ts index 406afd3c..e2fb902e 100644 --- a/test/crai.test.ts +++ b/test/crai.test.ts @@ -62,7 +62,7 @@ describe('.crai reader', () => { () => { throw new Error('the getIndex call should have failed') }, - err => { + (err: unknown) => { expect(`${err}`).toMatch(/invalid/) }, ) @@ -146,7 +146,7 @@ describe('reading a BAI file instead', () => { () => { throw new Error('the getIndex call should have failed') }, - err => { + (err: unknown) => { expect(`${err}`).toMatch(/bai/) }, ) diff --git a/test/cram2sam.ts b/test/cram2sam.ts index 3b3cd9b3..6c25073a 100644 --- a/test/cram2sam.ts +++ b/test/cram2sam.ts @@ -1,8 +1,9 @@ +/* eslint-disable no-console */ import { IndexedFasta } from '@gmod/indexedfasta' import { CraiIndex, IndexedCramFile } from '../src' import CramRecord from '../src/cramFile/record' -if (process.argv.length != 7) { +if (process.argv.length !== 7) { process.stderr.write( 'Usage: node jkb_test.js REF.fa input.cram tid start end\n', ) @@ -13,20 +14,20 @@ const chr = process.argv[4] const startStr = process.argv[5] const endStr = process.argv[6] -const start = parseInt(startStr) -const end = parseInt(endStr) +const start = Number.parseInt(startStr) +const end = Number.parseInt(endStr) // Fasta const t = new IndexedFasta({ path: process.argv[2], - faiPath: process.argv[2] + '.fai', + faiPath: `${process.argv[2]}.fai`, }) // open local files const indexedFile = new IndexedCramFile({ cramPath: process.argv[3], index: new CraiIndex({ - path: process.argv[3] + '.crai', + path: `${process.argv[3]}.crai`, }), seqFetch: async (seqId, start, end) => { // note: @@ -60,7 +61,7 @@ function decodeSeqCigar(record: CramRecord) { seq += ref.slice(last_pos - refStart, refPos - refStart) last_pos = refPos - if (oplen && op != 'M') { + if (oplen && op !== 'M') { cigar += oplen + op oplen = 0 } @@ -86,7 +87,7 @@ function decodeSeqCigar(record: CramRecord) { seq += sub last_pos++ oplen++ - } else if (code == 'D' || code == 'N') { + } else if (code === 'D' || code === 'N') { // Deletion or Ref Skip last_pos += data if (oplen) { @@ -94,7 +95,7 @@ function decodeSeqCigar(record: CramRecord) { } cigar += data + code oplen = 0 - } else if (code == 'I' || code == 'S') { + } else if (code === 'I' || code === 'S') { // Insertion or soft-clip seq += data if (oplen) { @@ -102,37 +103,37 @@ function decodeSeqCigar(record: CramRecord) { } cigar += data.length + code oplen = 0 - } else if (code == 'i') { + } else if (code === 'i') { // Single base insertion seq += data if (oplen) { cigar += oplen + op } - cigar += 1 + 'I' + cigar += `1I` oplen = 0 - } else if (code == 'P') { + } else if (code === 'P') { // Padding if (oplen) { cigar += oplen + op } - cigar += data + 'P' - } else if (code == 'H') { + cigar += `${data}P` + } else if (code === 'H') { // Hard clip if (oplen) { cigar += oplen + op } - cigar += data + 'H' + cigar += `${data}H` oplen = 0 } // else q or Q }) } else { sublen = record.readLength - seq.length } - if (seq.length != record.readLength) { + if (seq.length !== record.readLength) { sublen = record.readLength - seq.length seq += ref.slice(last_pos - refStart, last_pos - refStart + sublen) - if (oplen && op != 'M') { + if (oplen && op !== 'M') { cigar += oplen + op oplen = 0 } @@ -167,8 +168,8 @@ function tags2str(record: CramRecord, RG: string[]) { } } - if (typeof record.readGroupId !== undefined && record.readGroupId >= 0) { - str += '\tRG:Z:' + RG[record.readGroupId] + if (record.readGroupId >= 0) { + str += `\tRG:Z:${RG[record.readGroupId]}` } return str } @@ -179,16 +180,13 @@ async function run() { const seqList = await t.getSequenceNames() let tid: string | number = chr // ie numeric or string form seqList.forEach((name, id) => { - if (name == chr) { + if (name === chr) { tid = id return } }) const hdr = await indexedFile.cram.getSamHeader() - if (!hdr) { - throw new Error('getSamHeader returned undefined') - } const RG: string[] = [] let nRG = 0 for (const line of hdr) { @@ -207,7 +205,7 @@ async function run() { } const records = await indexedFile.getRecordsForRange(tid >>> 0, start, end) - //return; // benchmark decoder only + // return; // benchmark decoder only let refStart: number | undefined = undefined records.forEach(record => { @@ -236,7 +234,7 @@ async function run() { // eslint-disable-next-line @typescript-eslint/no-unused-vars const _tlen = record.templateSize // only if detached const tags = tags2str(record, RG) - // eslint-disable-next-line no-console + console.log( `${record.readName}\t${record.flags}\t${seqList[record.sequenceId]}\t${ record.alignmentStart @@ -245,4 +243,6 @@ async function run() { }) } -run().catch(e => console.error(e)) +run().catch(e => { + console.error(e) +}) diff --git a/test/data/set_seqs.js b/test/data/set_seqs.js deleted file mode 100644 index 3d4826c5..00000000 --- a/test/data/set_seqs.js +++ /dev/null @@ -1,118 +0,0 @@ -/* eslint-disable */ - -'use strict' - -var _stringify = require('babel-runtime/core-js/json/stringify') - -var _stringify2 = _interopRequireDefault(_stringify) - -var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray') - -var _slicedToArray3 = _interopRequireDefault(_slicedToArray2) - -var _entries = require('babel-runtime/core-js/object/entries') - -var _entries2 = _interopRequireDefault(_entries) - -var _typeof2 = require('babel-runtime/helpers/typeof') - -var _typeof3 = _interopRequireDefault(_typeof2) - -var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray') - -var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2) - -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { default: obj } -} - -var fs = require('fs') - -function getFeatures(data) { - var features = [] - if (data.length && data.forEach) { - data.forEach(function (d) { - features.push.apply( - features, - (0, _toConsumableArray3.default)(getFeatures(d)), - ) - }) - } else if (data.features) { - features.push.apply( - features, - (0, _toConsumableArray3.default)(data.features), - ) - } else if ( - (typeof data === 'undefined' - ? 'undefined' - : (0, _typeof3.default)(data)) === 'object' - ) { - ;(0, _entries2.default)(data).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray3.default)(_ref, 2), - k = _ref2[0], - d = _ref2[1] - - features.push.apply( - features, - (0, _toConsumableArray3.default)(getFeatures(d)), - ) - }) - } - return features -} - -fs.readdirSync('.') - .filter(function (f) { - return /dump.json/.test(f) - }) - //.filter(f => /ce#1000/.test(f)) - .forEach(function (filename) { - var data = require('./' + filename) - var features = getFeatures(data) - console.log(filename + ' has ' + features.length + ' features') - - var samFile = filename.replace('.dump.json', '.sam') - if (fs.existsSync(samFile)) { - console.log(filename + ' has a sam file') - var sequences = {} - fs.readFileSync(samFile) - .toString('ascii') - .split('\n') - .forEach(function (line) { - var fields = line.split('\t') - var name = fields[0] - var seq = fields[9] - if (!sequences[name]) sequences[name] = [] - sequences[name].push(seq) - }) - - // if (sequences.s0c) { - // console.log(sequences.s0c) - // } - - var replaced = false - features.forEach(function (feature) { - var samSeq = - sequences[feature.readName] && sequences[feature.readName][0] - if (feature.readBases === '*') { - delete feature.readBases - replaced = true - } - if (samSeq) { - if (samSeq !== feature.readBases) replaced = true - if (samSeq === '*') { - delete feature.readBases - } else { - feature.readBases = samSeq - } - // console.log(`${feature.readName} = ${samSeq}`) - sequences[feature.readName].shift() - } - }) - if (replaced) { - fs.writeFileSync(filename, (0, _stringify2.default)(data, null, ' ')) - } - } else { - console.log(filename + ' has no sam file') - } - }) diff --git a/test/dump1.test.ts b/test/dump1.test.ts index ce23e1a0..1790f1a4 100644 --- a/test/dump1.test.ts +++ b/test/dump1.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { test, expect } from 'vitest' import { t1 as testFileList } from './lib/testFileList' import { testDataFile } from './lib/util' diff --git a/test/dump2.test.ts b/test/dump2.test.ts index 77fcd3a5..4813360c 100644 --- a/test/dump2.test.ts +++ b/test/dump2.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { test, expect } from 'vitest' import { t2 as testFileList } from './lib/testFileList' import { testDataFile } from './lib/util' diff --git a/test/indexedfile.test.ts b/test/indexedfile.test.ts index c951c598..5f31202c 100644 --- a/test/indexedfile.test.ts +++ b/test/indexedfile.test.ts @@ -57,8 +57,16 @@ describe('.crai indexed cram file', () => { }), }) - const features = await cram.getRecordsForRange(0, 0, Infinity) - const features2 = await cram.getRecordsForRange(-1, 0, Infinity) + const features = await cram.getRecordsForRange( + 0, + 0, + Number.POSITIVE_INFINITY, + ) + const features2 = await cram.getRecordsForRange( + -1, + 0, + Number.POSITIVE_INFINITY, + ) expect(features).toMatchSnapshot() expect(features2).toMatchSnapshot() }) @@ -105,7 +113,11 @@ describe('.crai indexed cram file', () => { index: new CraiIndex({ filehandle: testDataFile(`${filename}.crai`) }), }) - const features = await cram.getRecordsForRange(0, 0, Infinity) + const features = await cram.getRecordsForRange( + 0, + 0, + Number.POSITIVE_INFINITY, + ) features.sort((a, b) => (a.readName || '').localeCompare(b.readName || ''), ) @@ -119,7 +131,11 @@ describe('.crai indexed cram file', () => { index: new CraiIndex({ filehandle: testDataFile(`${filename}.crai`) }), }) - const features = await cram.getRecordsForRange(1, 0, Infinity) + const features = await cram.getRecordsForRange( + 1, + 0, + Number.POSITIVE_INFINITY, + ) expect(features.length).toBeGreaterThan(-1) expect(features).toMatchSnapshot() }) @@ -240,8 +256,8 @@ test('region not downloading enough records', async () => { }) const entries = await index.getEntriesForRange(0, 75100635, 75125544) expect(entries.length).toEqual(2) - expect(entries[0].start).toEqual(74378949) - expect(entries[1].start).toEqual(74945118) + expect(entries[0]!.start).toEqual(74378949) + expect(entries[1]!.start).toEqual(74945118) }) test('troublesome file returns the correct sequence', async () => { diff --git a/test/lib/dumpFile.ts b/test/lib/dumpFile.ts index 1a0cc736..eb6e5343 100644 --- a/test/lib/dumpFile.ts +++ b/test/lib/dumpFile.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck async function dumpSlice(container, sliceOffset) { const slice = container.getSlice(sliceOffset) const header = await slice.getHeader() diff --git a/test/lib/fasta/index.ts b/test/lib/fasta/index.ts index 17c1c57e..063aba02 100644 --- a/test/lib/fasta/index.ts +++ b/test/lib/fasta/index.ts @@ -4,7 +4,7 @@ function parseSmallFasta(text: string) { .filter(t => /\S/.test(t)) .map(entryText => { const [defLine, ...seq] = entryText.split('\n') - const [id, ...des] = defLine.split(' ') + const [id, ...des] = defLine!.split(' ') const description = des.join(' ') const sequence = seq.join('').replace(/\s/g, '') return { id, description, sequence } diff --git a/test/lib/syncLocalFile.ts b/test/lib/syncLocalFile.ts index 20bb7df7..5d910b97 100644 --- a/test/lib/syncLocalFile.ts +++ b/test/lib/syncLocalFile.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import fs from 'fs' const fsOpen = fs.openSync @@ -12,7 +12,7 @@ class LocalFile { this.filename = source } - async read(buffer, offset = 0, length, position) { + async read(buffer, offset, length, position) { let readPosition = position if (readPosition === null) { readPosition = this.position diff --git a/test/lossy-names.test.ts b/test/lossy-names.test.ts index 16d42236..b44918f3 100644 --- a/test/lossy-names.test.ts +++ b/test/lossy-names.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { describe, it, expect } from 'vitest' import { CraiIndex, IndexedCramFile } from '../src' diff --git a/test/parse.test.ts b/test/parse.test.ts index 26f376c6..d1110cea 100644 --- a/test/parse.test.ts +++ b/test/parse.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { describe, it, expect } from 'vitest' import { CramFile } from '../src' diff --git a/test/retry.test.ts b/test/retry.test.ts index 83b8b86d..d3921e41 100644 --- a/test/retry.test.ts +++ b/test/retry.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { describe, it, expect } from 'vitest' import mock from 'mock-fs' import LocalFile from './lib/syncLocalFile' @@ -20,7 +20,6 @@ describe('retry nonexist file', () => { }) await cram.cram.getSamHeader() - // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (_e) { exception = 1 } @@ -44,7 +43,6 @@ describe('retry nonexist file', () => { }) await cram.getRecordsForRange(0, 2, 200) - // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (_e) { exception = 1 } diff --git a/test/util.test.ts b/test/util.test.ts index afc69926..14a24612 100644 --- a/test/util.test.ts +++ b/test/util.test.ts @@ -1,4 +1,4 @@ -//@ts-nocheck +// @ts-nocheck import { describe, it, expect } from 'vitest' import { sequenceMD5 } from '../src/cramFile/util' diff --git a/yarn.lock b/yarn.lock index bd941afc..2e5e04fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -19,9 +19,9 @@ picocolors "^1.0.0" "@babel/compat-data@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.2.tgz#e41928bd33475305c586f6acbbb7e3ade7a6f7f5" - integrity sha512-bYcppcpKBvX4znYaPEeFau03bp89ShqNMLs+rmdptMw+heSZh9+z84d2YG+K7cYLbWwzdjtDoW/uqZmPjulClQ== + version "7.25.4" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.25.4.tgz#7d2a80ce229890edcf4cc259d4d696cb4dae2fcb" + integrity sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ== "@babel/core@^7.18.10": version "7.25.2" @@ -44,12 +44,12 @@ json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.18.10", "@babel/generator@^7.25.0": - version "7.25.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" - integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== +"@babel/generator@^7.18.10", "@babel/generator@^7.25.0", "@babel/generator@^7.25.4": + version "7.25.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.5.tgz#b31cf05b3fe8c32d206b6dad03bb0aacbde73450" + integrity sha512-abd43wyLfbWoxC6ahM8xTkqLpGB2iWBVyuKC9/srhFunCd1SDNrV1s72bBpK4hLj8KLzHBBcOblvLQZBNw9r3w== dependencies: - "@babel/types" "^7.25.0" + "@babel/types" "^7.25.4" "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" jsesc "^2.5.1" @@ -124,12 +124,12 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.10.5", "@babel/parser@^7.18.11", "@babel/parser@^7.24.7", "@babel/parser@^7.25.0", "@babel/parser@^7.25.3": - version "7.25.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" - integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== +"@babel/parser@^7.10.5", "@babel/parser@^7.18.11", "@babel/parser@^7.24.7", "@babel/parser@^7.25.0", "@babel/parser@^7.25.4": + version "7.25.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.4.tgz#af4f2df7d02440286b7de57b1c21acfb2a6f257a" + integrity sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA== dependencies: - "@babel/types" "^7.25.2" + "@babel/types" "^7.25.4" "@babel/template@^7.25.0": version "7.25.0" @@ -141,22 +141,22 @@ "@babel/types" "^7.25.0" "@babel/traverse@^7.10.5", "@babel/traverse@^7.18.11", "@babel/traverse@^7.24.7", "@babel/traverse@^7.25.2": - version "7.25.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" - integrity sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ== + version "7.25.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.4.tgz#648678046990f2957407e3086e97044f13c3e18e" + integrity sha512-VJ4XsrD+nOvlXyLzmLzUs/0qjFS4sK30te5yEFlvbbUNEgKaVb2BHZUpAL+ttLPQAHNrsI3zZisbfha5Cvr8vg== dependencies: "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.25.0" - "@babel/parser" "^7.25.3" + "@babel/generator" "^7.25.4" + "@babel/parser" "^7.25.4" "@babel/template" "^7.25.0" - "@babel/types" "^7.25.2" + "@babel/types" "^7.25.4" debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.18.10", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2": - version "7.25.2" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" - integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== +"@babel/types@^7.18.10", "@babel/types@^7.24.7", "@babel/types@^7.25.0", "@babel/types@^7.25.2", "@babel/types@^7.25.4": + version "7.25.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.4.tgz#6bcb46c72fdf1012a209d016c07f769e10adcb5f" + integrity sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ== dependencies: "@babel/helper-string-parser" "^7.24.8" "@babel/helper-validator-identifier" "^7.24.7" @@ -294,10 +294,10 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.0.tgz#b0ffd0312b4a3fd2d6f77237e7248a5ad3a680ae" integrity sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A== -"@eslint/config-array@^0.17.1": - version "0.17.1" - resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.17.1.tgz#d9b8b8b6b946f47388f32bedfd3adf29ca8f8910" - integrity sha512-BlYOpej8AQ8Ev9xVqroV7a02JK3SkBAaN9GfMMH9W6Ch8FlQlkjGw4Ir7+FgYwfirivAf4t+GtzuAxqfukmISA== +"@eslint/config-array@^0.18.0": + version "0.18.0" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.18.0.tgz#37d8fe656e0d5e3dbaea7758ea56540867fd074d" + integrity sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw== dependencies: "@eslint/object-schema" "^2.1.4" debug "^4.3.1" @@ -318,10 +318,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.9.0": - version "9.9.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.9.0.tgz#d8437adda50b3ed4401964517b64b4f59b0e2638" - integrity sha512-hhetes6ZHP3BlXLxmd8K2SNgkhNSi+UcecbnwWKwpP7kyi/uC75DJ1lOOBO3xrC4jyojtGE3YxKZPHfk4yrgug== +"@eslint/js@9.9.1": + version "9.9.1" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.9.1.tgz#4a97e85e982099d6c7ee8410aacb55adaa576f06" + integrity sha512-xIDQRsfg5hNBqHz04H1R3scSVwmI+KUbqjsQKHKQ1DAUSaUjYPReZZmS/5PNiKu1fUvzDd6H7DEDKACSEhu+TQ== "@eslint/object-schema@^2.1.4": version "2.1.4" @@ -536,23 +536,7 @@ dependencies: "@types/ms" "*" -"@types/eslint-scope@^3.7.3": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "9.6.0" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.0.tgz#51d4fe4d0316da9e9f2c80884f2c20ed5fb022ff" - integrity sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*", "@types/estree@1.0.5", "@types/estree@^1.0.0", "@types/estree@^1.0.5": +"@types/estree@1.0.5", "@types/estree@^1.0.0", "@types/estree@^1.0.5": version "1.0.5" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== @@ -569,7 +553,7 @@ dependencies: "@types/unist" "^2" -"@types/json-schema@*", "@types/json-schema@^7.0.8": +"@types/json-schema@^7.0.8": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -597,9 +581,9 @@ integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== "@types/node@*": - version "22.5.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.0.tgz#10f01fe9465166b4cab72e75f60d8b99d019f958" - integrity sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg== + version "22.5.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.5.1.tgz#de01dce265f6b99ed32b295962045d10b5b99560" + integrity sha512-KkHsxej0j9IW1KKOOAA/XBA0z08UFSrRQHErzEfA3Vgq57eXIMYboIlHJuYIfd+lwCQjtKqUu3UnmKbtUc9yRw== dependencies: undici-types "~6.19.2" @@ -628,85 +612,85 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.11.tgz#11af57b127e32487774841f7a4e54eab166d03c4" integrity sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA== -"@typescript-eslint/eslint-plugin@8.2.0", "@typescript-eslint/eslint-plugin@^8.0.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.2.0.tgz#bf50e9c8dac6bdf15dd1b52ca29448550903558e" - integrity sha512-02tJIs655em7fvt9gps/+4k4OsKULYGtLBPJfOsmOq1+3cdClYiF0+d6mHu6qDnTcg88wJBkcPLpQhq7FyDz0A== +"@typescript-eslint/eslint-plugin@8.3.0", "@typescript-eslint/eslint-plugin@^8.0.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.3.0.tgz#726627fad16d41d20539637efee8c2329fe6be32" + integrity sha512-FLAIn63G5KH+adZosDYiutqkOkYEx0nvcwNNfJAf+c7Ae/H35qWwTYvPZUKFj5AS+WfHG/WJJfWnDnyNUlp8UA== dependencies: "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "8.2.0" - "@typescript-eslint/type-utils" "8.2.0" - "@typescript-eslint/utils" "8.2.0" - "@typescript-eslint/visitor-keys" "8.2.0" + "@typescript-eslint/scope-manager" "8.3.0" + "@typescript-eslint/type-utils" "8.3.0" + "@typescript-eslint/utils" "8.3.0" + "@typescript-eslint/visitor-keys" "8.3.0" graphemer "^1.4.0" ignore "^5.3.1" natural-compare "^1.4.0" ts-api-utils "^1.3.0" -"@typescript-eslint/parser@8.2.0", "@typescript-eslint/parser@^8.0.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.2.0.tgz#de3993304feb98576d9ffbf10c83ca1bcb68a5dd" - integrity sha512-j3Di+o0lHgPrb7FxL3fdEy6LJ/j2NE8u+AP/5cQ9SKb+JLH6V6UHDqJ+e0hXBkHP1wn1YDFjYCS9LBQsZDlDEg== +"@typescript-eslint/parser@8.3.0", "@typescript-eslint/parser@^8.0.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.3.0.tgz#3c72c32bc909cb91ce3569e7d11d729ad84deafa" + integrity sha512-h53RhVyLu6AtpUzVCYLPhZGL5jzTD9fZL+SYf/+hYOx2bDkyQXztXSc4tbvKYHzfMXExMLiL9CWqJmVz6+78IQ== dependencies: - "@typescript-eslint/scope-manager" "8.2.0" - "@typescript-eslint/types" "8.2.0" - "@typescript-eslint/typescript-estree" "8.2.0" - "@typescript-eslint/visitor-keys" "8.2.0" + "@typescript-eslint/scope-manager" "8.3.0" + "@typescript-eslint/types" "8.3.0" + "@typescript-eslint/typescript-estree" "8.3.0" + "@typescript-eslint/visitor-keys" "8.3.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.2.0.tgz#4a4bd7e7df5522acc8795c3b6f21e8c41b951138" - integrity sha512-OFn80B38yD6WwpoHU2Tz/fTz7CgFqInllBoC3WP+/jLbTb4gGPTy9HBSTsbDWkMdN55XlVU0mMDYAtgvlUspGw== +"@typescript-eslint/scope-manager@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.3.0.tgz#834301d2e70baf924c26818b911bdc40086f7468" + integrity sha512-mz2X8WcN2nVu5Hodku+IR8GgCOl4C0G/Z1ruaWN4dgec64kDBabuXyPAr+/RgJtumv8EEkqIzf3X2U5DUKB2eg== dependencies: - "@typescript-eslint/types" "8.2.0" - "@typescript-eslint/visitor-keys" "8.2.0" + "@typescript-eslint/types" "8.3.0" + "@typescript-eslint/visitor-keys" "8.3.0" -"@typescript-eslint/type-utils@8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.2.0.tgz#5cd7fef50f492e5a0f508bdd40678861a57c3549" - integrity sha512-g1CfXGFMQdT5S+0PSO0fvGXUaiSkl73U1n9LTK5aRAFnPlJ8dLKkXr4AaLFvPedW8lVDoMgLLE3JN98ZZfsj0w== +"@typescript-eslint/type-utils@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.3.0.tgz#c1ae6af8c21a27254321016b052af67ddb44a9ac" + integrity sha512-wrV6qh//nLbfXZQoj32EXKmwHf4b7L+xXLrP3FZ0GOUU72gSvLjeWUl5J5Ue5IwRxIV1TfF73j/eaBapxx99Lg== dependencies: - "@typescript-eslint/typescript-estree" "8.2.0" - "@typescript-eslint/utils" "8.2.0" + "@typescript-eslint/typescript-estree" "8.3.0" + "@typescript-eslint/utils" "8.3.0" debug "^4.3.4" ts-api-utils "^1.3.0" -"@typescript-eslint/types@8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.2.0.tgz#dfe9895a2812f7c6bf7af863054c22a67060420c" - integrity sha512-6a9QSK396YqmiBKPkJtxsgZZZVjYQ6wQ/TlI0C65z7vInaETuC6HAHD98AGLC8DyIPqHytvNuS8bBVvNLKyqvQ== +"@typescript-eslint/types@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.3.0.tgz#378e62447c2d7028236e55a81d3391026600563b" + integrity sha512-y6sSEeK+facMaAyixM36dQ5NVXTnKWunfD1Ft4xraYqxP0lC0POJmIaL/mw72CUMqjY9qfyVfXafMeaUj0noWw== -"@typescript-eslint/typescript-estree@8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.2.0.tgz#fbdb93a1c7ac7f1f96ae2de4fc97cd64c60ae894" - integrity sha512-kiG4EDUT4dImplOsbh47B1QnNmXSoUqOjWDvCJw/o8LgfD0yr7k2uy54D5Wm0j4t71Ge1NkynGhpWdS0dEIAUA== +"@typescript-eslint/typescript-estree@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.3.0.tgz#3e3d38af101ba61a8568f034733b72bfc9f176b9" + integrity sha512-Mq7FTHl0R36EmWlCJWojIC1qn/ZWo2YiWYc1XVtasJ7FIgjo0MVv9rZWXEE7IK2CGrtwe1dVOxWwqXUdNgfRCA== dependencies: - "@typescript-eslint/types" "8.2.0" - "@typescript-eslint/visitor-keys" "8.2.0" + "@typescript-eslint/types" "8.3.0" + "@typescript-eslint/visitor-keys" "8.3.0" debug "^4.3.4" - globby "^11.1.0" + fast-glob "^3.3.2" is-glob "^4.0.3" minimatch "^9.0.4" semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.2.0.tgz#02d442285925f28d520587185f295f932702e733" - integrity sha512-O46eaYKDlV3TvAVDNcoDzd5N550ckSe8G4phko++OCSC1dYIb9LTc3HDGYdWqWIAT5qDUKphO6sd9RrpIJJPfg== +"@typescript-eslint/utils@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.3.0.tgz#b10972319deac5959c7a7075d0cf2b5e1de7ec08" + integrity sha512-F77WwqxIi/qGkIGOGXNBLV7nykwfjLsdauRB/DOFPdv6LTF3BHHkBpq81/b5iMPSF055oO2BiivDJV4ChvNtXA== dependencies: "@eslint-community/eslint-utils" "^4.4.0" - "@typescript-eslint/scope-manager" "8.2.0" - "@typescript-eslint/types" "8.2.0" - "@typescript-eslint/typescript-estree" "8.2.0" + "@typescript-eslint/scope-manager" "8.3.0" + "@typescript-eslint/types" "8.3.0" + "@typescript-eslint/typescript-estree" "8.3.0" -"@typescript-eslint/visitor-keys@8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.2.0.tgz#f6abb3b6508898a117175ddc11f9b9869cc96834" - integrity sha512-sbgsPMW9yLvS7IhCi8IpuK1oBmtbWUNP+hBdwl/I9nzqVsszGnNGti5r9dUtF5RLivHUFFIdRvLiTsPhzSyJ3Q== +"@typescript-eslint/visitor-keys@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.3.0.tgz#320d747d107af1eef1eb43fbc4ccdbddda13068b" + integrity sha512-RmZwrTbQ9QveF15m/Cl28n0LXD6ea2CjkhH5rQ55ewz3H24w+AMCJHPVYaZ8/0HoG8Z3cLLFFycRXxeO2tz9FA== dependencies: - "@typescript-eslint/types" "8.2.0" + "@typescript-eslint/types" "8.3.0" eslint-visitor-keys "^3.4.3" "@vitest/expect@2.0.5": @@ -1025,11 +1009,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - assertion-error@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-2.0.1.tgz#f641a196b335690b1070bf00b6e7593fec190bf7" @@ -1121,9 +1100,9 @@ callsites@^3.0.0: integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== caniuse-lite@^1.0.30001646: - version "1.0.30001651" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz#52de59529e8b02b1aedcaaf5c05d9e23c0c28138" - integrity sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg== + version "1.0.30001653" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001653.tgz#b8af452f8f33b1c77f122780a4aecebea0caca56" + integrity sha512-XGWQVB8wFQ2+9NZwZ10GxTYC5hk0Fa+q8cSkr0tgvMhYhMHP/QC+WTgrePMDBWiWc/pV+1ik82Al20XOK25Gcw== ccount@^2.0.0: version "2.0.1" @@ -1357,13 +1336,6 @@ diff@^5.0.0, diff@^5.1.0: resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - doctrine-temporary-fork@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine-temporary-fork/-/doctrine-temporary-fork-2.1.0.tgz#36f2154f556ee4f1e60311d391cd23de5187ed57" @@ -1437,7 +1409,7 @@ emoji-regex@^9.2.2: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== -enhanced-resolve@^5.17.0: +enhanced-resolve@^5.17.1: version "5.17.1" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== @@ -1588,15 +1560,15 @@ eslint-visitor-keys@^4.0.0: integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== eslint@^9.9.0: - version "9.9.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.9.0.tgz#8d214e69ae4debeca7ae97daebbefe462072d975" - integrity sha512-JfiKJrbx0506OEerjK2Y1QlldtBxkAlLxT5OEcRF8uaQ86noDe2k31Vw9rnSWv+MXZHj7OOUV/dA0AhdLFcyvA== + version "9.9.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.9.1.tgz#147ac9305d56696fb84cf5bdecafd6517ddc77ec" + integrity sha512-dHvhrbfr4xFQ9/dq+jcVneZMyRYLjggWjk6RVsIiHsP8Rz6yZ8LvZ//iU4TrZF+SXWG+JkNF2OyiZRvzgRDqMg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.11.0" - "@eslint/config-array" "^0.17.1" + "@eslint/config-array" "^0.18.0" "@eslint/eslintrc" "^3.1.0" - "@eslint/js" "9.9.0" + "@eslint/js" "9.9.1" "@humanwhocodes/module-importer" "^1.0.1" "@humanwhocodes/retry" "^0.3.0" "@nodelib/fs.walk" "^1.2.8" @@ -1712,7 +1684,7 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.9: +fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -1938,18 +1910,6 @@ globals@^15.7.0: resolved "https://registry.yarnpkg.com/globals/-/globals-15.9.0.tgz#e9de01771091ffbc37db5714dab484f9f69ff399" integrity sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA== -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" - graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" @@ -2655,7 +2615,7 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.3.0, merge2@^1.4.1: +merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -2934,9 +2894,9 @@ micromark@^3.0.0: uvu "^0.5.0" micromatch@^4.0.4: - version "4.0.7" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" - integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== + version "4.0.8" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: braces "^3.0.3" picomatch "^2.3.1" @@ -3236,11 +3196,6 @@ path-scurry@^2.0.0: lru-cache "^11.0.0" minipass "^7.1.2" -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - pathe@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/pathe/-/pathe-1.1.2.tgz#6c4cb47a945692e48a1ddd6e4094d170516437ec" @@ -3615,11 +3570,6 @@ signal-exit@^4.0.1, signal-exit@^4.1.0: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - source-map-js@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" @@ -3875,9 +3825,9 @@ ts-api-utils@^1.3.0: integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== tslib@^2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" - integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" @@ -3902,13 +3852,13 @@ type-fest@^2.0.0, type-fest@^2.5.0: integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== typescript-eslint@^8.0.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.2.0.tgz#90d75636b663a9f5e391e9b3a33f3031236a25c8" - integrity sha512-DmnqaPcML0xYwUzgNbM1XaKXpEb7BShYf2P1tkUmmcl8hyeG7Pj08Er7R9bNy6AufabywzJcOybQAtnD/c9DGw== + version "8.3.0" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.3.0.tgz#f4d9c5ba71f6bead03ec41ecb2bece1de511e49f" + integrity sha512-EvWjwWLwwKDIJuBjk2I6UkV8KEQcwZ0VM10nR1rIunRDIP67QJTZAHBXTX0HW/oI1H10YESF8yWie8fRQxjvFA== dependencies: - "@typescript-eslint/eslint-plugin" "8.2.0" - "@typescript-eslint/parser" "8.2.0" - "@typescript-eslint/utils" "8.2.0" + "@typescript-eslint/eslint-plugin" "8.3.0" + "@typescript-eslint/parser" "8.3.0" + "@typescript-eslint/utils" "8.3.0" typescript@^5.0.3: version "5.5.4" @@ -4179,11 +4129,10 @@ webpack-sources@^3.2.3: integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== webpack@^5.90.3: - version "5.93.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.93.0.tgz#2e89ec7035579bdfba9760d26c63ac5c3462a5e5" - integrity sha512-Y0m5oEY1LRuwly578VqluorkXbvXKh7U3rLoQCEO04M97ScRr44afGVkI0FQFsXzysk5OgFAxjZAb9rsGQVihA== + version "5.94.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f" + integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== dependencies: - "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.5" "@webassemblyjs/ast" "^1.12.1" "@webassemblyjs/wasm-edit" "^1.12.1" @@ -4192,7 +4141,7 @@ webpack@^5.90.3: acorn-import-attributes "^1.9.5" browserslist "^4.21.10" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.17.0" + enhanced-resolve "^5.17.1" es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0"