-
Notifications
You must be signed in to change notification settings - Fork 887
Rewrite no-unused-expression and remove no-unused-new #2269
Conversation
Integrate `no-unused-new` into this rule. [new-rule-option] `allow-new-side-effects` restores the old behaviour to allow `new` for side effects [bugfix] allow comma separated assignments Fixes: #2058 [bugfix] allow indirect eval: `(0, eval)("");` [enhancement] checking for unused new can now use option `allow-fast-null-checks` Fixes: #1839 [enhancement] find unused comma separated expressions in all locations of the code [enhancement] find unused expressions inside void expression Refs: #2244
Rename `allow-new-side-effects` to `allow-new` Add `allow-tagged-template`
I added special handling for tagged templates to fix #2293 behind a new config option to explicitly allow them. For me that was the best way to go as I don't want to encourage anyone to use tag functions for side effects. That's just my opinion. I can still remove the option and make it the default.
|
I agree, sgtm
Nah, I think this is fine since it's going into 5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
PR checklist
Overview of change:
[removed-rule]
no-unused-new
removed, with logic moved intono-unused-expression
[new-rule-option]
no-unused-expression
adds optionallow-new
to allownew
without using the new object[new-rule-option]
no-unused-expression
adds optionallow-tagged-template
to allow tagged templates for side effectsFixes #2293
[bugfix]
no-unused-expression
allow comma separated assignmentsFixes: #2058
[enhancement]
no-unused-expression
allow indirect eval(0, eval)("");
[enhancement]
no-unused-expression
checking for unused new can now use optionallow-fast-null-checks
Fixes: #1839
[enhancement]
no-unused-expression
find unused comma separated expressions in all locations of the code[enhancement]
no-unused-expression
find unused expressions inside void expressionIs there anything you'd like reviewers to focus on?
As @andy-hanson mentioned in #2244
no-unused-new
is not worth its own rule. This PR integrates it inno-unused-expression
and removes the rule.