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
Formatting rule & plugin order #415
Comments
the order that plugins are listed in the array should affect the order they are executed, but some plugins use
maybe I should update everything is applied in a single pass/loop to improve performance, otherwise every single plugin would require a full loop and there would be no way for us to add something like |
It seems reasonable but a bit of a hack. Maybe we should shift the responsibility of deciding what gets grouped into a single pass to the user? For example: plugins: [
// Group these 2 into single pass
['esformatter-quotes', 'esformatter-var-each'],
// Run as its own pass after the others
'esformatter-use-strict'
// Alternative synax: `['esformatter-use-strict']`
],
// Flag to enable new behavior so we can preserve backwards compatibility
// and performance for default behavior
multiplePasses: true |
I was planning to implement something similar to what @twolfson suggested but I'm thinking that we should keep the current behavior for now. There are plugins like esformatter-jsx that removes some nodes during The Sorry, but I'm going to close it as wontfix for now. |
It should be possible to configure the order in which plugins are executed.
It should also be possible to configure whether plugins are executed before or after default rules.
Currently if I have "esformatter-use-strict" plugin and "esformatter-quotes" plugin configured to use double quotes, I end up with "use strict" having single quotes in the resulting formatted code.
The text was updated successfully, but these errors were encountered: