Skip to content

Fix: Fix false positives/negatives in require-meta-fixable rule #158

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

Merged

Conversation

bmish
Copy link
Member

@bmish bmish commented Jul 9, 2021

False positives fixed:

  • When meta.fixable uses a variable

False negatives fixed:

  • When there's a fixer but meta.fixable = null
  • When there's a fixer but meta.fixable = undefined

Also improves reporting location.

I'll be opening a few more PRs after this to make similar fixes to other rules.

@bmish bmish force-pushed the require-meta-fixable-fixes branch from 51a460d to c700f40 Compare July 9, 2021 15:51
False positives fixed:

* When `meta.fixable` uses a variable

False negatives fixed:

* When there's a fixer but `meta.fixable` = null
* When there's a fixer but `meta.fixable` = undefined

Also improves reporting location.
@bmish bmish force-pushed the require-meta-fixable-fixes branch from c700f40 to 0bfea94 Compare July 9, 2021 15:53
});
} };
```

Copy link
Contributor

Choose a reason for hiding this comment

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

why removing the example? it seems a good example to have.

Copy link
Member Author

@bmish bmish Jul 11, 2021

Choose a reason for hiding this comment

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

This example shows the rule without any meta object. I would consider this to be a rare edge case, and I would argue that including too many unimportant edge cases can distract from the primary examples and make the documentation too long and difficult to understand. The key point we're trying to get across is that "fixable being missing" is in invalid case, and that's already covered by the test case above this one.

If you still prefer, I can add it back, but just wanted to make my case against it.

Copy link
Contributor

@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!

@aladdin-add aladdin-add merged commit dc29b03 into eslint-community:master Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants