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

WIP: Fix bug causing line numbers to be swallowed #23

Closed
wants to merge 2 commits into from

Conversation

theotherdon
Copy link

Fixes a bug causing line numbers to be swallowed for fatal errors. The bug was being caused because line numbers were being discarded for fatal errors when collecting offences to report.

Don Schrimsher added 2 commits February 5, 2021 08:11
Adds a file to the fixture git repo to the logic for showing line
numbers for fatal errors in ESLint - such as when the keyword class is encountered and a version of ES is specified that doesn't support classes.
Fixes a bug causing line numbers to be swallowed for fatal errors in
ESLint. WIP since some tests are failing and they're a bit difficult to
understand, so I haven't been able to figure out what's going on in a
reasonable amount of time. Opening a WIP PR and issue to ask the author.
@theotherdon theotherdon requested a review from a team as a code owner February 5, 2021 14:42
@theotherdon
Copy link
Author

theotherdon commented Feb 5, 2021

It appears that there's an assumption that all fatal errors are parser errors that don't contain paths or line numbers. However, upon investigation, it appears that there are many fatal errors that are parser errors that contain paths and line numbers.After a bit of tinkering, I was able to get paths and line numbers to show up. But, there are a couple of failing tests that are hard to follow that I wasn't able to figure out in a reasonable amount of time, so I wanted to open up this WIP PR to see if someone could point me in the right direction.

Also, I'm trying to add a test to cover this bug, but I'm running into issues there as well. The code isn't returning any patches for the commit that I added to the child/fixture repo under test.git. Here are the steps that I took to make the commit. I confirmed that the objects are being correctly created (as far as I can tell) under the test.git/git folder. However, when I drop a binding.pry into my test to see what the patches look like, I'm getting an empty array. Here's the commit where I created and added the file to the child/fixture repo. I also listed out the steps that I took to do this below. Am I missing something here?

  1. Navigate to the test.git folder: cd spec/fixtures/test.git.
  2. Move the git folder to .git: mv git .git.
  3. Create a file called fatal-errors.js.
  4. Add and commit the file: git commit -a.
  5. Move the .git folder back to the git folder: mv .git git.
  6. Navigate back up the root of the parent repo: cd ../../../.
  7. Add and commit all changes: git commit -a.

@theotherdon
Copy link
Author

theotherdon commented Feb 5, 2021

To fix #22. I think this will also fix #17.

@ashkulz ashkulz marked this pull request as draft February 9, 2021 04:41
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.

1 participant