Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Rewrite no-unused-expression and remove no-unused-new #2269

Merged
merged 5 commits into from
Mar 10, 2017
Merged

Rewrite no-unused-expression and remove no-unused-new #2269

merged 5 commits into from
Mar 10, 2017

Conversation

ajafff
Copy link
Contributor

@ajafff ajafff commented Feb 28, 2017

PR checklist

Overview of change:

[removed-rule] no-unused-new removed, with logic moved into no-unused-expression
[new-rule-option] no-unused-expression adds option allow-new to allow new without using the new object
[new-rule-option] no-unused-expression adds option allow-tagged-template to allow tagged templates for side effects
Fixes #2293
[bugfix] no-unused-expression allow comma separated assignments
Fixes: #2058
[enhancement] no-unused-expression allow indirect eval (0, eval)("");
[enhancement] no-unused-expression checking for unused new can now use option allow-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 expression

Is 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 in no-unused-expression and removes the rule.

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`
@ajafff ajafff changed the title Rewrite no-unused-expression and deprecate no-unused-new Rewrite no-unused-expression and remove no-unused-new Mar 8, 2017
@ajafff
Copy link
Contributor Author

ajafff commented Mar 8, 2017

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.

no-unused-new is now completely removed. Let me know if we need a temporary solution to deprecate it properly

@adidahiya
Copy link
Contributor

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 agree, sgtm

no-unused-new is now completely removed. Let me know if we need a temporary solution to deprecate it properly

Nah, I think this is fine since it's going into 5.0

Copy link
Contributor

@nchen63 nchen63 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants