Skip to content
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

Fix: Remove autofixer for no-unsafe-negation #12157

Merged
merged 1 commit into from Sep 13, 2019
Merged

Conversation

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 24, 2019

What is the purpose of this pull request? (put an "X" next to item)

[X] Bug fix

This is a PR to remove the autofix feature from no-unsafe-negation, as it intentionally changes the runtime behavior of the code.

Tell us about your environment

  • ESLint Version: 6.2.0
  • Node Version: 10.16.0
  • npm Version: 6.9.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
    ecmaVersion: 2015,
  },
};

What did you do? Please include the actual source code causing the issue.

/*eslint no-unsafe-negation:error*/

if (!key in object) {
  foo(key);
}

What did you expect to happen?

Error, but not the auto-fix.

What actually happened? Please include the actual, raw output from ESLint.

/*eslint no-unsafe-negation:error*/

if (!(key in object)) {
  foo(key);
}

What changes did you make? (Give an overview)

Removed the fixer.

Is there anything you'd like reviewers to focus on?

Is this is a non-breaking change?

Documentation is missing some important details, I'll fix that in another PR.

@eslint eslint bot added the triage label Aug 24, 2019
@platinumazure

This comment has been minimized.

Copy link
Member

platinumazure commented Aug 24, 2019

Hi @mdjermanovic, thanks for the PR.

Is there a circumstance in which the user would legitimately want !foo in bar? We've removed autofixers with less impact in the past, but I'm just trying to understand the motivation here.

@mdjermanovic

This comment has been minimized.

Copy link
Member Author

mdjermanovic commented Aug 24, 2019

Is there a circumstance in which the user would legitimately want !foo in bar?

Most likely not :-)

I think it's a policy to never modify behavior, I believe this is the only rule of all rules that have auto-fix that does that intentionally.

@platinumazure

This comment has been minimized.

Copy link
Member

platinumazure commented Aug 24, 2019

Labeling as non-breaking enhancement for now. Feel free to relabel as needed.

Copy link
Member

aladdin-add left a comment

LGTM, thanks!

@mysticatea mysticatea added accepted and removed evaluating labels Sep 13, 2019
Copy link
Member

mysticatea left a comment

LGTM, thank you!

@mysticatea mysticatea added bug and removed enhancement labels Sep 13, 2019
@mysticatea mysticatea merged commit a41fdc0 into master Sep 13, 2019
9 checks passed
9 checks passed
commit-message Commit message follows guidelines
Details
continuous-integration Build #20190824.1 succeeded
Details
continuous-integration (Test on Node.js 10 (Linux)) Test on Node.js 10 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Linux)) Test on Node.js 12 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Windows)) Test on Node.js 12 (Windows) succeeded
Details
continuous-integration (Test on Node.js 12 (macOS)) Test on Node.js 12 (macOS) succeeded
Details
continuous-integration (Test on Node.js 8 (Linux)) Test on Node.js 8 (Linux) succeeded
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
@mysticatea mysticatea deleted the nounsafenegation-fixer branch Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.