xojs / eslint-config-xo-typescript

ESLint shareable config for TypeScript to be used with eslint-config-xo
MIT License
171 stars 25 forks source link

`@typescript-eslint/no-throw-literal`: Enable `allowThrowingUnknown` option #51

Closed fregante closed 2 years ago

fregante commented 2 years ago

This piece of configuration is currently blocking plain code like:


try {
    sorry()
} catch (error) {
    if (isCanadian(error)) {
        return;
    }

    throw error; // ERROR error
}
sindresorhus commented 2 years ago

I think you should open an issue on the ESLint TypeScript project. Ideally, there should be an option called allowRethrowingUnknown. I think allowing throwing unknown in general is pretty unsafe, but I'm ok with allowing this for now.