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
feat: predictible json/json5 handling #24612
feat: predictible json/json5 handling #24612
Conversation
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This comment was marked as outdated.
This comment was marked as outdated.
🎉 This PR is included in version 37.48.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
parsedJson = JSON5.parse(content); | ||
logger.warn( | ||
{ context }, | ||
'File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log message is a bit confusing. How about something like this:
File contents are invalid JSON but parse corectly as JSON5. In a future release, Renovate will strictly parse JSON as JSON, and JSON5 as JSON5. To prevent breaking your Renovate config in a upcoming major release: please make sure the file extension matches the content syntax.
In any case, we should be clear about:
- Current behavior (Renovate silently eats wrong file format)
- Upcoming behavior (Renovate will parse strictly according to file extension)
- What the user most do to prevent future breakage (make sure file extension matches file content syntax)
Co-authored-by: Rhys Arkins <rhys@arkins.net> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Changes
JSON5.parse
, first try and parse the file withJSON.parse
JSON.parse
try parsing withJSON5.parse
and if parsed, log a warning message for the user to notify of the inconsistent behaviourContext
Closes: #24554
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via: