Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eslint): Enforce that ts-expect-error is used #8987

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/integrations/inboundfilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function _getPossibleEventMessages(event: Event): string[] {

let lastException;
try {
// @ts-ignore Try catching to save bundle size
// @ts-expect-error Try catching to save bundle size
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
lastException = event.exception.values[event.exception.values.length - 1];
} catch (e) {
Expand Down
10 changes: 3 additions & 7 deletions packages/eslint-config-sdk/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,9 @@ module.exports = {
// Unused variables should be removed unless they are marked with and underscore (ex. _varName).
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],

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

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