no-unused-expressions: support allowTaggedTemplates option
#17496
Closed
jasonkuhrt
started this conversation in
Feature Request
Replies: 1 comment 1 reply
-
|
It already supports this option: https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-unused-expressions.html#allowtaggedtemplates Are there bugs with this rule when you have that option set to |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
The
no-unused-expressionsrule currently flags tagged template literals as unused expressions, even when they're used for side effects. ESLint's equivalent rule supports anallowTaggedTemplatesoption to handle this pattern. Would oxlint consider adding this option?Use Case
Tagged template literals are commonly used as a fluent API for building strings with side effects:
This pattern appears in:
logTagged template message``)Current Behavior
oxlint reports:
Requested Behavior
Add an
allowTaggedTemplatesoption (matching ESLint's API) that permits tagged template expressions as statements:{ "rules": { "eslint/no-unused-expressions": ["error", { "allowTaggedTemplates": true }] } }ESLint Reference
ESLint's
no-unused-expressionsrule supports this option:Workaround
Currently disabling the rule entirely:
{ "rules": { "eslint/no-unused-expressions": "off" } }This loses the benefit of catching actual unused expressions elsewhere in the codebase.
Environment: oxlint 1.34.0
Beta Was this translation helpful? Give feedback.
All reactions