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
Add support for prettier configuration file. #886
Add support for prettier configuration file. #886
Conversation
For some reason the test fail on the CI but pass on my machine. 🤔 Investigating. |
(Forgot to include the test prettier configuration file in the patch 😅) |
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.
Adding this argument will break things for people who are using older versions. I recommend adding an option for turning this --config
option on, and leaving it off by default for now until people have had the opportunity to upgrade.
Using the argument with an older version doesn't seem to break, but prints a message to stderr. When you say adding an option, do you mean adding something like a |
Oh, does it ignore the additional argument? I'd expect that most programs would just stop working entirely if you use an invalid argument. |
Yup it ignores it on prettier 1.5.0, I haven't tried previous versions. But you're right it is probably safer to add an option in case previous versions don't ignore the argument. What do you think about the |
I think it would be best to add an option in ALE specific to prettier, like |
Oops, yeah that's what I meant 😅 |
As of version 1.6.0, prettier allows passing a `--config` argument with a path to a configuration file.
Added the |
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 is looking better. See my comments here.
|
||
return { | ||
\ 'command': ale#Escape(ale#fixers#prettier#GetExecutable(a:buffer)) | ||
\ . ' %t' | ||
\ . ' ' . l:options | ||
\ . (!empty(l:options) ? ' ' . l:options : '') | ||
\ . (l:use_config ? ' --config ' . ale#Escape(l:config) : '') |
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 also need to check !empty(l:config)
here.
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 could use && !empty(l:config)
for the value of l:use_config
above.
*b:ale_javascript_prettier_use_local_config* | ||
Type: |Number| | ||
Default: `0` | ||
|
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.
Add a short description here explaining what the option does when set to 1
.
Updated. |
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.
Looks fine to me.
Cheers! 🍻 |
* upstream/master: Make the check-supported-tools-tables script work on more machines Add a missing scriptencoding line Add support for prettier configuration file. (dense-analysis#886)
As of version 1.6.0,
prettier
allows passing a--config
argument with a path to a configuration file.This PR adds support for this argument when a configuration file is present and some tests inspired by the rubocop fixer tests.