Skip to content

Commit 729a220

Browse files
committed
Update deps
1 parent e2cd381 commit 729a220

13 files changed

+1235
-723
lines changed

.eslintrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 84 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,100 @@
1-
import prettier from 'eslint-plugin-prettier'
2-
import typescriptEslint from '@typescript-eslint/eslint-plugin'
3-
import tsParser from '@typescript-eslint/parser'
4-
import path from 'node:path'
5-
import { fileURLToPath } from 'node:url'
6-
import js from '@eslint/js'
7-
import { FlatCompat } from '@eslint/eslintrc'
1+
import eslint from '@eslint/js'
2+
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
3+
import tseslint from 'typescript-eslint'
84

9-
const __filename = fileURLToPath(import.meta.url)
10-
const __dirname = path.dirname(__filename)
11-
const compat = new FlatCompat({
12-
baseDirectory: __dirname,
13-
recommendedConfig: js.configs.recommended,
14-
allConfig: js.configs.all,
15-
})
16-
17-
export default [
18-
...compat.extends(
19-
'plugin:@typescript-eslint/recommended',
20-
'plugin:@typescript-eslint/recommended-type-checked',
21-
'plugin:@typescript-eslint/stylistic-type-checked',
22-
'plugin:prettier/recommended',
23-
'plugin:unicorn/recommended',
24-
),
5+
export default tseslint.config(
6+
{
7+
ignores: [
8+
'webpack.config.js',
9+
'dist/*',
10+
'esm/*',
11+
'example/*',
12+
'eslint.config.mjs',
13+
],
14+
},
2515
{
26-
plugins: {
27-
prettier,
28-
'@typescript-eslint': typescriptEslint,
29-
},
30-
3116
languageOptions: {
32-
parser: tsParser,
33-
ecmaVersion: 5,
34-
sourceType: 'script',
35-
3617
parserOptions: {
37-
project: './tsconfig.lint.json',
18+
project: ['./tsconfig.lint.json'],
19+
tsconfigRootDir: import.meta.dirname,
3820
},
3921
},
22+
},
23+
eslint.configs.recommended,
24+
...tseslint.configs.recommended,
25+
...tseslint.configs.stylisticTypeChecked,
26+
...tseslint.configs.strictTypeChecked,
4027

28+
eslintPluginUnicorn.configs['flat/recommended'],
29+
{
4130
rules: {
31+
'@typescript-eslint/no-unused-vars': [
32+
'warn',
33+
{
34+
argsIgnorePattern: '^_',
35+
ignoreRestSiblings: true,
36+
},
37+
],
38+
4239
'no-underscore-dangle': 0,
4340
curly: 'error',
44-
'unicorn/prefer-node-protocol': 0,
45-
'unicorn/numeric-separators-style': 0,
46-
'unicorn/prevent-abbreviations': 0,
47-
'unicorn/no-new-array': 0,
48-
'unicorn/filename-case': 0,
49-
'@typescript-eslint/restrict-template-expressions': 0,
5041
'@typescript-eslint/no-explicit-any': 0,
5142
'@typescript-eslint/explicit-module-boundary-types': 0,
5243
'@typescript-eslint/ban-ts-comment': 0,
5344
semi: ['error', 'never'],
45+
'unicorn/no-new-array': 'off',
46+
'unicorn/no-empty-file': 'off',
47+
'unicorn/prefer-type-error': 'off',
48+
'unicorn/prefer-modern-math-apis': 'off',
49+
'unicorn/prefer-node-protocol': 'off',
50+
'unicorn/no-unreadable-array-destructuring': 'off',
51+
'unicorn/no-abusive-eslint-disable': 'off',
52+
'unicorn/no-array-callback-reference': 'off',
53+
'unicorn/number-literal-case': 'off',
54+
'unicorn/prefer-add-event-listener': 'off',
55+
'unicorn/prefer-top-level-await': 'off',
56+
'unicorn/consistent-function-scoping': 'off',
57+
'unicorn/no-await-expression-member': 'off',
58+
'unicorn/no-lonely-if': 'off',
59+
'unicorn/consistent-destructuring': 'off',
60+
'unicorn/prefer-module': 'off',
61+
'unicorn/prefer-optional-catch-binding': 'off',
62+
'unicorn/no-useless-undefined': 'off',
63+
'unicorn/no-null': 'off',
64+
'unicorn/no-nested-ternary': 'off',
65+
'unicorn/filename-case': 'off',
66+
'unicorn/catch-error-name': 'off',
67+
'unicorn/prevent-abbreviations': 'off',
68+
'unicorn/prefer-code-point': 'off',
69+
'unicorn/numeric-separators-style': 'off',
70+
'unicorn/no-array-for-each': 'off',
71+
'unicorn/prefer-spread': 'off',
72+
'unicorn/explicit-length-check': 'off',
73+
'unicorn/prefer-regexp-test': 'off',
74+
'unicorn/relative-url-style': 'off',
75+
'unicorn/prefer-math-trunc': 'off',
76+
'unicorn/prefer-query-selector': 'off',
77+
'unicorn/no-negated-condition': 'off',
78+
'unicorn/switch-case-braces': 'off',
79+
'unicorn/prefer-switch': 'off',
80+
'unicorn/better-regex': 'off',
81+
'unicorn/no-for-loop': 'off',
82+
'unicorn/escape-case': 'off',
83+
'unicorn/prefer-number-properties': 'off',
84+
'unicorn/no-process-exit': 'off',
85+
'unicorn/prefer-at': 'off',
86+
'@typescript-eslint/no-unsafe-member-access': 'off',
87+
'@typescript-eslint/no-unsafe-argument': 'off',
88+
'@typescript-eslint/no-unsafe-assignment': 'off',
89+
'@typescript-eslint/no-unsafe-call': 'off',
90+
'@typescript-eslint/no-unsafe-return': 'off',
91+
'@typescript-eslint/prefer-nullish-coalescing': 'off',
92+
'@typescript-eslint/require-await': 'off',
93+
'@typescript-eslint/restrict-template-expressions': 'off',
94+
'@typescript-eslint/restrict-plus-operands': 'off',
95+
'@typescript-eslint/no-deprecated': 'off',
96+
'@typescript-eslint/no-non-null-assertion': 'off',
97+
'no-empty': 'off',
5498
},
5599
},
56-
]
100+
)

jest.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
"src"
2121
],
2222
"scripts": {
23-
"test": "jest",
24-
"lint": "eslint --report-unused-disable-directives --max-warnings 0 src test",
23+
"test": "vitest",
24+
"lint": "eslint --report-unused-disable-directives --max-warnings 0",
2525
"clean": "rimraf dist esm",
2626
"prebuild": "npm run clean",
2727
"build:esm": "tsc --target es2018 --outDir esm",
2828
"build:es5": "tsc --target es2015 --module commonjs --outDir dist",
2929
"build": "npm run build:esm && npm run build:es5",
30-
"prepublishOnly": "npm test && npm run build",
30+
"prepublishOnly": "npm test --run && npm run build",
3131
"postversion": "git push --follow-tags"
3232
},
3333
"keywords": [
@@ -42,27 +42,25 @@
4242
},
4343
"devDependencies": {
4444
"@types/es6-promisify": "^6.0.0",
45-
"@types/jest": "^29.5.2",
4645
"@types/long": "^4.0.1",
47-
"@types/node": "^20.14.11",
46+
"@types/node": "^22.10.1",
4847
"@types/pako": "^2.0.0",
49-
"@typescript-eslint/eslint-plugin": "^7.7.1",
50-
"@typescript-eslint/parser": "^7.7.1",
48+
"@typescript-eslint/eslint-plugin": "^8.16.0",
49+
"@typescript-eslint/parser": "^8.16.0",
5150
"eslint": "^9.7.0",
52-
"eslint-config-prettier": "^9.1.0",
5351
"eslint-plugin-import": "^2.27.5",
54-
"eslint-plugin-prettier": "^5.1.3",
55-
"eslint-plugin-unicorn": "^54.0.0",
56-
"jest": "^29.5.0",
52+
"eslint-plugin-unicorn": "^56.0.1",
5753
"prettier": "^3.2.5",
5854
"rimraf": "^6.0.1",
59-
"ts-jest": "^29.1.0",
60-
"typescript": "^5.1.3"
55+
"typescript": "^5.1.3",
56+
"typescript-eslint": "^8.16.0",
57+
"vitest": "^2.1.6"
6158
},
6259
"publishConfig": {
6360
"access": "public"
6461
},
6562
"browser": {
66-
"./esm/unzip.js": "./esm/unzip-pako.js"
63+
"./esm/unzip.js": "./esm/unzip-pako.js",
64+
"./dist/unzip.js": "./dist/unzip-pako.js"
6765
}
6866
}

src/bgzFilehandle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default class BgzFilehandle {
5151
// read the last block's ISIZE (see gzip RFC),
5252
// and add it to its uncompressedPosition
5353
const ret = await this.gzi.getLastBlock()
54+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
5455
if (!ret) {
5556
throw new Error('no blocks')
5657
}

src/gziIndex.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export default class GziIndex {
9696
// read starts in and extend forward from that
9797
const compare = (entry: number[], nextEntry: number[]) => {
9898
const uncompressedPosition = entry[UNCOMPRESSED_POSITION]
99+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
99100
const nextUncompressedPosition = nextEntry
100101
? nextEntry[UNCOMPRESSED_POSITION]
101102
: Infinity

src/unzip-pako.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface Chunk {
1717
// in a browser.
1818
//
1919
//
20-
// eslint-disable-next-line @typescript-eslint/require-await
20+
2121
async function unzip(inputData: Buffer) {
2222
try {
2323
let strm
@@ -31,18 +31,16 @@ async function unzip(inputData: Buffer) {
3131
inflator = new Inflate()
3232
//@ts-ignore
3333
;({ strm } = inflator)
34-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
34+
3535
inflator.push(remainingInput, Z_SYNC_FLUSH)
3636
if (inflator.err) {
3737
throw new Error(inflator.msg)
3838
}
3939

40-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4140
pos += strm.next_in
4241
chunks[i] = inflator.result as Uint8Array
4342
totalSize += chunks[i].length
4443
i += 1
45-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4644
} while (strm.avail_in)
4745

4846
const result = new Uint8Array(totalSize)
@@ -53,7 +51,7 @@ async function unzip(inputData: Buffer) {
5351
return Buffer.from(result)
5452
} catch (error) {
5553
//cleanup error message
56-
if (/incorrect header check/.test(`${error}`)) {
54+
if (`${error}`.includes('incorrect header check')) {
5755
throw new Error(
5856
'problem decompressing block: incorrect gzip header check',
5957
)
@@ -65,7 +63,7 @@ async function unzip(inputData: Buffer) {
6563
// similar to pakounzip, except it does extra counting to return the positions
6664
// of compressed and decompressed data offsets
6765
//
68-
// eslint-disable-next-line @typescript-eslint/require-await
66+
6967
async function unzipChunk(inputData: Buffer) {
7068
try {
7169
let strm
@@ -79,7 +77,7 @@ async function unzipChunk(inputData: Buffer) {
7977
const inflator = new Inflate()
8078
// @ts-ignore
8179
;({ strm } = inflator)
82-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
80+
8381
inflator.push(remainingInput, Z_SYNC_FLUSH)
8482
if (inflator.err) {
8583
throw new Error(inflator.msg)
@@ -91,17 +89,15 @@ async function unzipChunk(inputData: Buffer) {
9189
cpositions.push(cpos)
9290
dpositions.push(dpos)
9391

94-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
9592
cpos += strm.next_in
9693
dpos += buffer.length
97-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
9894
} while (strm.avail_in)
9995

10096
const buffer = Buffer.concat(blocks)
10197
return { buffer, cpositions, dpositions }
10298
} catch (error) {
10399
//cleanup error message
104-
if (/incorrect header check/.test(`${error}`)) {
100+
if (`${error}`.includes('incorrect header check')) {
105101
throw new Error(
106102
'problem decompressing block: incorrect gzip header check',
107103
)
@@ -113,7 +109,7 @@ async function unzipChunk(inputData: Buffer) {
113109
// similar to unzipChunk above but slices (0,minv.dataPosition) and
114110
// (maxv.dataPosition,end) off
115111
//
116-
// eslint-disable-next-line @typescript-eslint/require-await
112+
117113
async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
118114
try {
119115
let strm
@@ -131,7 +127,7 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
131127
const inflator = new Inflate()
132128
// @ts-ignore
133129
;({ strm } = inflator)
134-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
130+
135131
inflator.push(remainingInput, Z_SYNC_FLUSH)
136132
if (inflator.err) {
137133
throw new Error(inflator.msg)
@@ -149,7 +145,7 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
149145
len = chunks[0].length
150146
}
151147
const origCpos = cpos
152-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
148+
153149
cpos += strm.next_in
154150
dpos += len
155151

@@ -172,7 +168,6 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
172168
}
173169
totalSize += chunks[i].length
174170
i++
175-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
176171
} while (strm.avail_in)
177172

178173
const result = new Uint8Array(totalSize)
@@ -185,7 +180,7 @@ async function unzipChunkSlice(inputData: Buffer, chunk: Chunk) {
185180
return { buffer, cpositions, dpositions }
186181
} catch (error) {
187182
//cleanup error message
188-
if (/incorrect header check/.test(`${error}`)) {
183+
if (`${error}`.includes('incorrect header check')) {
189184
throw new Error(
190185
'problem decompressing block: incorrect gzip header check',
191186
)

src/unzip.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const gunzip = promisify(zlib.gunzip)
88
function nodeUnzip(input: Buffer): Promise<Buffer> {
99
//@ts-ignore
1010
return gunzip(input, {
11+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1112
finishFlush: (zlib.constants || zlib).Z_SYNC_FLUSH,
1213
})
1314
}

0 commit comments

Comments
 (0)