Skip to content

Commit 1cf5289

Browse files
committed
Chore: make ESLint happy
1 parent 7f58e17 commit 1cf5289

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

eslint.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ export default tseslint.config(
108108
'@typescript-eslint/switch-exhaustiveness-check': ['error', { allowDefaultCaseForExhaustiveSwitch: true, considerDefaultExhaustiveForUnions: true }],
109109
'@typescript-eslint/parameter-properties': ['warn', { prefer: 'parameter-property' }],
110110

111-
'@typescript-eslint/no-namespace': 'off'
111+
'@typescript-eslint/no-namespace': 'off',
112+
'@typescript-eslint/only-throw-error': ['error', { allowRethrowing: true, allowThrowingAny: true, allowThrowingUnknown: true }]
112113
}
113114
},
114115
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"svgo": "^3.0.2",
8383
"terser": "^5.21.0",
8484
"typescript": "^5.8.3",
85-
"typescript-eslint": "^8.31.1",
85+
"typescript-eslint": "^8.44.0",
8686
"uncss": "^0.17.3"
8787
},
8888
"peerDependencies": {

src/_modules/minifyCss.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,26 @@ const mod: HtmlnanoModule<CssnanoOptions> = {
2121
return tree;
2222
}
2323

24-
const promises: (Promise<void> | undefined)[] = [];
24+
const promises: Promise<void>[] = [];
25+
26+
let p: Promise<void> | undefined;
27+
2528
tree.walk((node) => {
2629
// Skip SRI, reasons are documented in "minifyJs" module
2730
if (node.attrs && 'integrity' in node.attrs) {
2831
return node;
2932
}
3033

3134
if (isStyleNode(node)) {
32-
promises.push(processStyleNode(node, cssnanoOptions, cssnano, postcss));
35+
p = processStyleNode(node, cssnanoOptions, cssnano, postcss);
36+
if (p) {
37+
promises.push(p);
38+
}
3339
} else if (node.attrs && node.attrs.style) {
34-
promises.push(processStyleAttr(node, cssnanoOptions, cssnano, postcss));
40+
p = processStyleAttr(node, cssnanoOptions, cssnano, postcss);
41+
if (p) {
42+
promises.push(p);
43+
}
3544
}
3645

3746
return node;

src/_modules/minifyJs.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ const mod: HtmlnanoModule<MinifyOptions> = {
1212

1313
if (!terser) return tree;
1414

15-
const promises: (Promise<void> | void)[] = [];
15+
const promises: Promise<void>[] = [];
16+
17+
let p: Promise<void> | undefined;
18+
1619
tree.walk((node) => {
1720
const nodeAttrs = node.attrs || {};
1821

@@ -35,7 +38,10 @@ const mod: HtmlnanoModule<MinifyOptions> = {
3538
if (node.tag && node.tag === 'script') {
3639
const mimeType = nodeAttrs.type || 'text/javascript';
3740
if (redundantScriptTypes.has(mimeType) || mimeType === 'module') {
38-
promises.push(processScriptNode(node, terserOptions, terser));
41+
p = processScriptNode(node, terserOptions, terser);
42+
if (p) {
43+
promises.push(p);
44+
}
3945
}
4046
}
4147

test/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Expect, expect } from 'expect';
1+
import { expect } from 'expect';
2+
import type { Expect } from 'expect';
23
import { isAmpBoilerplate, isComment, isConditionalComment, isStyleNode, extractCssFromStyleNode, optionalImport } from '../dist/helpers.mjs';
34

45
describe('[helpers]', () => {

0 commit comments

Comments
 (0)