Skip to content

Commit 69d4823

Browse files
authored
chore(lint): Allow ts-ignore in Node integration tests (#13254)
Discovered today that TS 3.8 doesn't understand `// @ts-expect-error`. Since we test on Node 22 also with TS 3.8, we shouldn't use `ts-expect-error` in test files as TS 3.8 would simply ignore the comment and throw a type error. Instead, it's fine to use `@ts-ignore` in these test files.
1 parent 8fb3f24 commit 69d4823

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dev-packages/node-integration-tests/.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ module.exports = {
2020
},
2121
rules: {
2222
'@typescript-eslint/typedef': 'off',
23+
// Explicitly allow ts-ignore with description for Node integration tests
24+
// Reason: We run these tests on TS3.8 which doesn't support `@ts-expect-error`
25+
'@typescript-eslint/ban-ts-comment': [
26+
'error',
27+
{
28+
'ts-ignore': 'allow-with-description',
29+
'ts-expect-error': true,
30+
},
31+
],
2332
},
2433
},
2534
],

dev-packages/node-integration-tests/suites/tracing/meta-tags/test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ describe('getTraceMetaTags', () => {
1616
baggage: 'sentry-environment=production',
1717
});
1818

19-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
20-
// @ts-ignore
19+
// @ts-ignore - response is defined, types just don't reflect it
2120
const html = response?.response as unknown as string;
2221

2322
expect(html).toMatch(/<meta name="sentry-trace" content="cd7ee7a6fe3ebe7ab9c3271559bc203c-[a-z0-9]{16}-1"\/>/);

0 commit comments

Comments
 (0)