Highlights
no-unused-vars
Suggestions
The no-unused-vars
rule provides suggestions now! When the rule sees code with an unused variable like this:
const a = "Hello";
const b = "World!";
console.log(a);
It will now suggest removing the unused variable declaration:
const a = "Hello";
console.log(a);
Suggestions also work for more complex cases like unused function arguments, destructuring syntax, etc.
function avg(a, b, c) {
return (a + b) / 2;
}
console.log(avg(12, 13, 25));
after the suggestion is applied becomes:
function avg(a, b) {
return (a + b) / 2;
}
console.log(avg(12, 13, 25));
and
const [{ status, value, reason }] = await Promise.allSettled([promise1, promise2]);
if (status === "rejected") {
throw reason;
}
after the suggestion becomes:
const [{ status, reason }] = await Promise.allSettled([promise1, promise2]);
if (status === "rejected") {
throw reason;
}
no-unused-vars
suggestions mark the completion of months of work. We will likely further improve and fine-tune this feature in future updates.
Nullish message.fix
Allowed
Previously, if a processor returned a LintMessage
with a fix
property set to undefined
or null
, ESLint would crash with an unhelpful error message when trying to apply the autofix.
This problem has been fixed in the current release.
Features
eed91d1
feat: add suggestions tono-unused-vars
(#18352) (Tanuj Kanti)
Bug Fixes
67d683d
fix: fix crash whenmessage.fix
is nullish (#19168) (ntnyq)c618707
fix: ignore vars with non-identifier references in no-useless-assignment (#19200) (YeonJuan)
Documentation
3c22d2a
docs: updateyoda
toYoda
in [yoda](/docs/rules/yoda).md
for consistency (#19230) (루밀LuMir)e0a2203
docs: add missing backticks tono-sequences
(#19233) (루밀LuMir)4cc4881
docs: Update README (GitHub Actions Bot)3db6fdf
docs: [no-await-in-loop] expand on benefits and inapplicability (#19211) (Kirk Waiblinger)bf2a4f6
docs: add missing backticks tofunc-style
(#19227) (루밀LuMir)ba098bd
docs: add missing header toprefer-spread
(#19224) (루밀LuMir)b607ae6
docs: update description ofno-param-reassign
(#19220) (루밀LuMir)1eb424d
docs: add missing backticks toprefer-destructuring
(#19223) (루밀LuMir)85998d1
docs: add missing backticks tono-unneeded-ternary
(#19222) (루밀LuMir)b75b32c
docs: add missing backticks tono-new-func
(#19219) (루밀LuMir)a7700bc
docs: add missing backticks toid-length
(#19217) (루밀LuMir)e2bb429
docs: add missing backticks to [complexity](/docs/rules/complexity).md
(#19214) (루밀LuMir)045d716
docs: add missing)
toid-denylist
(#19213) (루밀LuMir)7fe4114
docs: Update README (GitHub Actions Bot)c743ba6
docs: add CSS language tono-restricted-syntax
(#19208) (Milos Djermanovic)1416d70
docs: add missing backticks toeqeqeq
(#19207) (루밀LuMir)b950c1b
docs: add missing backticks toprefer-object-spread
(#19206) (루밀LuMir)8a941cb
docs: update docs anddescription
ofrequire-unicode-regexp
(#19205) (루밀LuMir)cbab228
docs: Update README (GitHub Actions Bot)f2257ce
docs: update comments anddescription
ofno-script-url
(#19203) (루밀LuMir)365f0f4
docs: add missing backtick todefault-case-last
(#19202) (루밀LuMir)e6b84f5
docs: add missing punctuation in document (#19161) (루밀LuMir)c88708e
docs: replace quote with backtick indescription
offor-direction
(#19199) (루밀LuMir)a76f233
docs: use higher contrast color tokens for code comments (#19187) (Josh Goldberg ✨)db19502
docs: Update README (GitHub Actions Bot)
Chores
cc243c9
chore: upgrade to@eslint/js@9.17.0
(#19242) (Francesco Trotta)84c5787
chore: package.json update for @eslint/js release (Jenkins)4c4f53b
chore: add missing backticks toflags.js
(#19226) (루밀LuMir)4b3132c
chore: update dependency eslint-plugin-expect-type to ^0.6.0 (#19221) (renovate[bot])9bf2204
chore: add type definitions for theeslint-config-eslint
package (#19050) (Arya Emami)ee8c220
chore: fix incorrectname
property inintegration-tutorial-code
(#19218) (루밀LuMir)cca801d
chore: Upgrade cross-spawn to 7.0.6 (#19185) (folortin)