-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
module: allow JSONC imports #52699
module: allow JSONC imports #52699
Conversation
Review requested:
|
When I get a change, Ill adjust the small prettification differences |
Do any other runtimes support JSONC or plan to? |
I know Deno supports it with its builtin standard library (https://deno.land/[email protected]/jsonc), but I'm not sure about importing I'll need to check the other runtimes, and more about Denos imports |
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.
Blocking for the following reasons:
-
There's been no discussion of whether this is a good idea at all, much less something worth adding to core; and whether the best approach is via extending
import
as opposed to other alternatives such as a utility function. -
Importing JSON is supported by browsers and there is a spec around it. I'm unaware of anything similar for JSONC. We shouldn't add import abilities for unspecified types. That is better handled by userland hooks.
If #49704 ever gets revived, that could also facilitate this so users don't have to manually sort out something almost everyone wants. |
// Some comment | ||
/* Also | ||
a comment */ | ||
} |
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.
nit... looks like some linting issues with these files (among other things there should be a new-line at the end.
328ccd3
to
caa5897
Compare
112a5d6
to
5da0078
Compare
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.
I don't think this is a good feature to add either.
Additionally, the approach to strip comments from jsonc files is incorrect, check what userland modules do instead. Regular languages and all that..
This PR introduces the ability to import
JSONC
typed JSON files via the{ type: 'jsonc' }
import attribute.