
Highlights
New Rule preserve-caught-error
One new rule has been added to the core: preserve-caught-error.
This rule enforces the use of the cause property when throwing a new error inside a catch block.
An example of incorrect code for this rule:
/* eslint preserve-caught-error: "error" */
try {
// ...
} catch (error) {
throw new Error("Something went wrong");
}
An example of correct code for this rule:
/* eslint preserve-caught-error: "error" */
try {
// ...
} catch (error) {
throw new Error("Something went wrong", { cause: error });
}
Other notable changes
- The
no-empty-functionandno-empty-static-blockrules now provide suggestions to add an/* empty */comment when the function or class static block is intentionally empty. - The
no-emptyrule now allows emptyswitchstatements with a comment inside the body.
Features
42761fafeat: implement suggestions for no-empty-function (#20057) (jaymarvelz)102f444feat: implement suggestions for no-empty-static-block (#20056) (jaymarvelz)e51fffffeat: addpreserve-caught-errorrule (#19913) (Amnish Singh Arora)
Bug Fixes
10e7ae2fix: update uncloneable options error message (#20059) (soda-sorcery)bfa4601fix: ignore empty switch statements with comments in no-empty rule (#20045) (jaymarvelz)dfd11defix: addbeforeandafterto test case types (#20049) (Francesco Trotta)dabbe95fix: correct types forno-restricted-importsrule (#20034) (Milos Djermanovic)ea789c7fix: no-loss-of-precision false positive with uppercase exponent (#20032) (sethamus)
Documentation
d265515docs: improve phrasing - “if” → “even if” from getting-started section (#20074) (jjangga0214)a355a0edocs: invert comparison logic for example inno-vardoc page (#20064) (OTonGitHub)5082fc2docs: Update README (GitHub Actions Bot)99cfd7edocs: add missing “the” in rule deprecation docs (#20050) (Josh Goldberg ✨)6ad8973docs: update--no-ignoreand--ignore-patterndocumentation (#20036) (Francesco Trotta)8033b19docs: add documentation for--no-config-lookup(#20033) (Francesco Trotta)
Chores
da87f2fchore: upgrade @eslint/js@9.35.0 (#20077) (Milos Djermanovic)af2a087chore: package.json update for @eslint/js release (Jenkins)7055764test: removetests/lib/eslint/eslint.config.js(#20065) (Milos Djermanovic)84ffb96chore: update@eslint-community/eslint-utils(#20069) (Francesco Trotta)d5ef939refactor: remove deprecatedcontext.parserOptionsusage across rules (#20060) (sethamus)1b3881dchore: remove redundant word (#20058) (pxwanglu)
