-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Bug: [no-unused-expressions, no-empty-functions, possibly others...] extension rules crash with eslint v9.15.0 #10338
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
Bug: [no-unused-expressions, no-empty-functions, possibly others...] extension rules crash with eslint v9.15.0 #10338
Comments
Related to eslint/eslint#19134 |
I downgraded my project to eslint v9.14.0 and the crash is gone. Seems to be a regression in eslint itself. |
It looks like https://github.com/eslint/eslint/blob/main/lib/rules/no-unused-expressions.js#L79 for some reason, not sure if this inconsistency was always there, but typescript-eslint may want to propagate options in? |
Uh oh! @AviVahl, the image you shared is missing helpful alt text. Check #10338 (comment). Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
the crash is due to this change https://github.com/eslint/eslint/pull/17656/files#diff-b65ad05fc10a27a62ba130f4ec20fce33dfdfed6917e58581c91d59067aeb30b which makes typescript-eslint's way of using it break. |
Yes, as several have noted this is due to the |
search for |
perhaps the fix should be to match the new upstream defaultOptions behavior, and even use it for typescript-eslint rules via context.options (instead of second parameter)? |
I originally hit this bug with |
The thing to keep in mind is that we'll want to stay backwards compatible with eslint versions before 9.15. See also #6456. If you end up poking around with this and find a good solution, do feel free to raise a PR 🙂 |
Considered it, but it seems like a wider change, so I'm hesitant given my limited knowledge of this codebase... |
Totally fair! Rest assured that the root cause of this type of bug is very well understood by each of the maintenance team members, and will be addressed as soon as our bandwidth permits, unless a community champion is able to get to it first 🙂 |
First time looking into typescript-eslint/packages/utils/src/eslint-utils/RuleCreator.ts Lines 70 to 79 in 57d343b
To include return createRule<Options, MessageIds, PluginDocs>({
meta: {
...meta,
defaultOptions: rule.defaultOptions,
docs: {
...meta.docs,
url: urlCreator(name),
},
},
...rule,
}); You can extract The reason for this change is the introduction of the following update in ESLint: We should also update the I’d work on a PR for this, but I really need to get some sleep. |
@AviVahl our utilities have always supported a top-level Unfortunately ESLint core chose a different location for the
In the next major we'll likely converge on their solution to deduplicate things. |
@glass-ships Smells like a breaking change sneaking its way into a minor update. I've already locked all of my projects to v9.14.0 so I should be fine for now. I might look into it and see if I can craft a fix this weekend. If I can figure out the codebase in just a weekend, that is... I don't have high hopes, but I feel invested in this considering how I found it just an hour after v9.15.0 came out, after doing my routine |
Agreed! If you do happen to give this a shot, feel free to link me to your PR, I'd be happy to contribute however I can. |
This is the eslint patch I used to get it working with typescript-eslint and unicorn diff --git a/lib/rules/no-unused-expressions.js b/lib/rules/no-unused-expressions.js
index fd1437c1606a56cbce147d040d601d0acef3d24a..1ac2d6e45fbb04f93d9cccdc5265bb38c3701aca 100644
--- a/lib/rules/no-unused-expressions.js
+++ b/lib/rules/no-unused-expressions.js
@@ -76,7 +76,7 @@ module.exports = {
allowTernary,
allowTaggedTemplates,
enforceForJSX
- }] = context.options;
+ } = {}] = context.options;
/**
* Has AST suggesting a directive.
diff --git a/lib/rules/no-warning-comments.js b/lib/rules/no-warning-comments.js
index 628f5a2ac513303cc3fe2cc9adcbf1ae54128747..a42e8318e028c6a3717afceef3c949bf8eab5827 100644
--- a/lib/rules/no-warning-comments.js
+++ b/lib/rules/no-warning-comments.js
@@ -64,7 +64,7 @@ module.exports = {
create(context) {
const sourceCode = context.sourceCode;
- const [{ decoration, location, terms: warningTerms }] = context.options;
+ const [{ decoration, location, terms: warningTerms } = this.meta.defaultOptions[0]] = context.options;
const escapedDecoration = escapeRegExp(decoration ? decoration.join("") : "");
const selfConfigRegEx = /\bno-warning-comments\b/u; |
I had the same problem with V10.8.2 . it stopped happening if I downgraded the version to v9.14.0. |
The issue is known. The fix is in progress. Please subscribe to this issue to keep updated. |
The fix has merged and will soon be released to our |
This comment was marked as resolved.
This comment was marked as resolved.
Hello, I just installed |
Can you provide details and/or a reproduction? |
* deps: lock file maintenance * Temporarily downgrade ESLint due to typescript-eslint/typescript-eslint#10338 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: AaronMoat <2937187+AaronMoat@users.noreply.github.com>
If you think this isn't fixed, please file a new issue and provide a complete reproduction and we can investigate. |
Update: The fix is now live in our 8.15.0 release! 🎉 If you encounter issues when you try it out, please double-check that each of the |
Before You File a Bug Report Please Confirm You Have Done The Following...
Issue Description
eslint crashes when using the latest version of node 22 and the latest version of typescript-eslint.
Reproduction Repository Link
https://github.com/ext4cats/tseslint-8.14.0-bug
Repro Steps
Versions
typescript-eslint
8.14.0
TypeScript
5.6.3
ESLint
9.15.0
node
22.11.0
The text was updated successfully, but these errors were encountered: