mansona / lint-to-the-future

A modern way to progressively update your code to the best practices
54 stars 7 forks source link

handle invalid JSON from previousResults #33

Closed wandroll closed 1 year ago

wandroll commented 1 year ago

The goal of this MR is for the CLI to be able to recover from previousResult URL returning a 200 but with an invalid JSON.

mansona commented 1 year ago

Hey thanks for the PR 👍

I'm trying to understand the reason for this though. Do you know why your data.json got corrupted?

I'm a bit concerned just merging this since I think it might be quite surprising to people. If you're using something like github-pages that's totally fine because you can go back and recover the data that would be lost with just "starting again", but if you were using something more ephemeral then the previous data might be lost forever.

At the very least I don't think this should be default behaviour. And maybe we could hide it behind a flag? something like --destructive-delete-past-data-on-error 😂 I joke about a bad flag name here but it might be good to make it ugly and verbose so people don't accidentally enable it and lose all their data.

What do you think?

wandroll commented 1 year ago

Hello, Yes , it was a very specific usecase : my json was not corrupted, just not accessible so the script was trying to parse an HTML page... Let's close it for now.