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

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-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Aug 24, 2019
@platinumazure
Copy link
Member

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
Copy link
Member Author

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 platinumazure added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Aug 24, 2019
@platinumazure
Copy link
Member

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

Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mysticatea mysticatea added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Sep 13, 2019
Copy link
Member

@mysticatea mysticatea left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@mysticatea mysticatea added bug ESLint is working incorrectly and removed enhancement This change enhances an existing feature of ESLint labels Sep 13, 2019
@mysticatea mysticatea merged commit a41fdc0 into master Sep 13, 2019
@mysticatea mysticatea deleted the nounsafenegation-fixer branch September 13, 2019 02:28
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 12, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants