-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Consider removing default parser / Skip processing unsupported file types #2884
Copy link
Copy link
Closed
Closed
Copy link
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken
Milestone
Description
Currently when
- Prettier is invoked from the CLI, and
- The file being formatted doesn't match any of the extensions supported, and
- No
--parseroption is passed, and - No
parseris in a prettier config file,
then it will fall back to the babylon parser and treat the file as JavaScript. This made sense when prettier only supported JS (and then TypeScript), but now that it supports vastly different languages perhaps it is time to challenge that default.
In #2882, we discovered this can have negative repercussions when used with --write **/*, modifying files inside of a .git directory.
If we were to change the default from JavaScript to a no-op, these kind of issues would go away, and we'd also have less issues reported along the lines of "My CSS doesn't parse", when they're accidentally using the babylon parser.
It is already possible to associate other extensions with a parser in .prettierrc.
{
"overrides": [{
"files": "*.mjs",
"options": { "parser": "babylon" }
}]
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.status:needs discussionIssues needing discussion and a decision to be made before action can be takenIssues needing discussion and a decision to be made before action can be taken