Optional Catch Binding: catch Without (e)

Rizal reads Oren’s profile with JSON.parse: catch (e), catch (_e) or a plain catch. See what the linter says, what becomes of e.message in a catch with no…

Why it matters

Plenty of real catch blocks never read their error: a fallback value, feature detection, a JSON.parse allowed to fail. An unread binding makes ESLint warn through no-unused-vars: since v9 catch bindings are checked too (caughtErrors: "all"), and the name _e is not exempt unless your project sets caughtErrorsIgnorePattern. catch { settles it at the syntax level: no name, nothing to complain about. (The lint verdict here is that rule with its default settings, checked for the code in the panel.)

The key idea

Don’t need the error? Write catch without (e)

Common mistakes

Try it in this playground