-
Notifications
You must be signed in to change notification settings - Fork 200
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
Recognize .mjs as JavaScript files #792
Conversation
@@ -71,6 +71,7 @@ export class AnalysisContext { | |||
readonly parsers = new Map<string, Parser<ParsedDocument>>([ | |||
['html', new HtmlParser()], | |||
['js', new JavaScriptParser()], | |||
['mjs', new JavaScriptParser()], |
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.
Of course, you could create a single const jsParser = new JavaScriptParser();
and then use the the same instance for both js
and mjs
.
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.
You can also skip all the import
/export
scanning for .mjs
files.
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.
Yeah, we want to add more contextual inference for treating a file as a script vs module, and .mjs would be a strong signal.
No objection to landing this as is though.
CI failure seems unrelated. |
What's blocking this? @bicknellr @justinfagnani @rictic @aomarks @usergenic |
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 LGTM, but we will need to wait for the tools team final review as well.
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 think we should merge this. @rictic @aomarks @usergenic thoughts?
@@ -71,6 +71,7 @@ export class AnalysisContext { | |||
readonly parsers = new Map<string, Parser<ParsedDocument>>([ | |||
['html', new HtmlParser()], | |||
['js', new JavaScriptParser()], | |||
['mjs', new JavaScriptParser()], |
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.
Yeah, we want to add more contextual inference for treating a file as a script vs module, and .mjs would be a strong signal.
No objection to landing this as is though.
This is a quick and dirty fix for #736.