CLI --config setting not working (prettier-eslint)
See original GitHub issueReporting an Issue
When reporting an issue, please include the following information in your post:
- Explain the Issue and Expected Behavior
- Prettier version
- JsPrettier Plug-in Version
- Platform Details
- Generated Prettier command line arguments
- Is the same behavior observed when run against Prettier directly?
- The contents of your
User/JsPrettier.sublime-settings
file - The contents of your
<project_name>.sublime-project
file (if applicable) - Steps to reproduce the behavior
Explain the Issue and Expected Behavior
I’m currently using prettier-eslint
and had trouble configuring it to work correctly. (It would be great if this plugin supported that as an option or had directions in the documentation.)
First, I updated the prettier_cli_path
to point to prettier-eslint
and confirmed that was working correctly. I have an .eslintrc
file in the project folder and I set prettier_cli_path
to the full path of prettier-eslint
and addtional_cli_args
with a blank --config
option, as #35 #84 suggested.
However, when I formatted a file, I noticed it was breaking lines more than it should (as if printWidth
was set lower than my 120). I debugged it step-by-step and found that the issue is that without a .prettierrc
file in the project path the JsPrettier settings are being used with --no-config
, regardless if additional_cli_args
is defined with a --config
setting. It seems --config
is appended to the end rather than taking over (for --no-config
and JsPrettier’s cli settings), which means the documentation using --config
as an option is misleading.
I can see this being an issue beyond my use case if people choose to define their config with additional_cli_args
according to the documention. I would assume you shouldn’t have to have a .prettierrc
file to use additional_cli_args
’s --config
.
Prettier version
1.12.0
JsPrettier Plug-in Version
1.20.17
Platform Details
I’m on Windows 10 with Sublime Text version 3.0, build 3143.
Generated Prettier command line arguments
Without .prettierrc
file (file paths removed):
-----------------------------------------
JsPrettier DEBUG - Prettier CLI Command
-----------------------------------------
<CLI_PATH>/prettier-eslint
--stdin
--no-config
--print-width 80
--single-quote false
--trailing-comma none
--bracket-spacing true
--jsx-bracket-same-line false
--parser babylon
--semi true
--require-pragma false
--prose-wrap preserve
--arrow-parens avoid
--tab-width 2
--use-tabs false
--stdin-filepath <PATH>\file.js
--ignore-path <PATH>\.prettierignore
--config
Prettier reported the following error(s):
Warning: `proseWrap` with boolean value is deprecated. Use "always", "never", or "preserve" instead.
● Validation Warning:
Unknown option "ignorePath" with value "...\\.prettierignore" was found.
This is probably a typing mistake. Fixing it will remove this message.
With blank .prettierrc
file (file paths removed):
-----------------------------------------
JsPrettier DEBUG - Prettier CLI Command
-----------------------------------------
<CLI_PATH>/prettier-eslint
--stdin
--tab-width 2
--use-tabs false
--stdin-filepath <PATH>file.js
--ignore-path <PATH>\.prettierignore
--config
Prettier reported the following error(s):
● Validation Warning:
Unknown option "configPrecedence" with value "cli-override" was found.
This is probably a typing mistake. Fixing it will remove this message.
● Validation Warning:
Unknown option "ignorePath" with value "...\\.prettierignore" was found.
This is probably a typing mistake. Fixing it will remove this message.
Is the same behavior observed when run against Prettier directly?
N/A
The contents of your User/JsPrettier.sublime-settings
file
Full path removed.
{
"debug": true,
"prettier_cli_path": "<CLI_PATH>/prettier-eslint",
"additional_cli_args": {
"--config": ""
},
"allow_inline_formatting": true
}
The contents of your <project_name>.sublime-project
file (if applicable)
N/A
Steps to reproduce the behavior
The steps one would take to reproduce and observe the problem.
- Set up JsPrettier with
additional_cli_settings
with--config
defined as blank""
. You can also point it at a config file with a custom name or outside the project path. - In a project folder with
.eslintrc
, format a file. Debug will show “no config used” and the JsPrettier cli options. - Add a valid
.prettierrc
file (mine is empty) to the project folder. - Format the file again. Debug will show “config resolved” without the JsPrettier options.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Thanks @CaitlinWeb. I’ll have a look.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.