Skip to content

Commit d3c3462

Browse files
authored
feat(eslint): Enforce that ts-expect-error is used (#8987)
Enforce that `@ts-expect-error` is used instead of `@ts-ignore`. This is done by updating the `typescript-eslint/ban-ts-comment` rule. https://typescript-eslint.io/rules/ban-ts-comment/
1 parent e7417e0 commit d3c3462

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/core/src/integrations/inboundfilters.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function _getPossibleEventMessages(event: Event): string[] {
177177

178178
let lastException;
179179
try {
180-
// @ts-ignore Try catching to save bundle size
180+
// @ts-expect-error Try catching to save bundle size
181181
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
182182
lastException = event.exception.values[event.exception.values.length - 1];
183183
} catch (e) {

packages/eslint-config-sdk/src/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@ module.exports = {
2626
// Unused variables should be removed unless they are marked with and underscore (ex. _varName).
2727
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
2828

29-
// Make sure that all ts-ignore comments are given a description.
30-
'@typescript-eslint/ban-ts-comment': [
31-
'warn',
32-
{
33-
'ts-ignore': 'allow-with-description',
34-
},
35-
],
29+
// Do not use ts-ignore, use ts-expect-error instead.
30+
// Also make sure that all ts-expect-error comments are given a description.
31+
'@typescript-eslint/ban-ts-comment': 'error',
3632

3733
// Types usage should be explicit as possible, so we prevent usage of inferrable types.
3834
// This is especially important because we have a public API, so usage needs to be as

0 commit comments

Comments
 (0)