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: fails the test case if autofix made syntax error (fixes #11615) #11798

Merged
merged 2 commits into from Jun 5, 2019

Conversation

mysticatea
Copy link
Member

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

[X] Bug fix #11615

What changes did you make? (Give an overview)

This PR fixes RuleTester to fail the test case if autofix made syntax errors.

Additionally,

  • fixes some test cases that autofix made syntax errors.
  • fixes the side-effect that overrides RuleTester.describe and RuleTester.it permanently in tests/lib/rule-tester/rule-tester.js. This side-effect had confused tests/lib/rules/*.js as using the stub functions to test rules.

I have noticed that errors property with a number allows syntax errors. Some of our tests depend on the behavior in order to use syntax error in rule's tests (E.g. tests/lib/rules/spaced-comment.js#L577-L589). I'm not sure if it's intentional, but I left it as is.

I wonder if we should deprecate the errors property with a number. It causes false negatives such as tests/lib/rules/complexity.js#L84.

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

Nothing in particular.

@mysticatea mysticatea added bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint core Relates to ESLint's core APIs and features accepted There is consensus among the team that this change meets the criteria for inclusion and removed enhancement This change enhances an existing feature of ESLint labels Jun 3, 2019
@mysticatea mysticatea changed the title Fix: fails the test case if autofix made syntax error (fixes #11615) Fix: fails the test case if autofix made syntax error (fixes #11615) Jun 3, 2019
Copy link
Member

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

Copy link
Member

@platinumazure platinumazure 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 merged commit 5509cdf into master Jun 5, 2019
@mysticatea mysticatea deleted the issue11615 branch June 5, 2019 09:05
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 3, 2019
@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 Dec 3, 2019
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 core Relates to ESLint's core APIs and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuleTester should report syntax error of fixed code
4 participants