.prettier.yaml Config File Not Detected At Project Level - User Settings Being Applied Instead
See original GitHub issueWhen 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
When I have a .prettier.yaml
file in my project’s root level it is not being detected on save settings.
What happens is that my default settings from my JsPrettier.sublime-settings
is applied instead.
Prettier version
To show the currently installed prettier version, run the following command:
$ prettier --version
2.1.2
JsPrettier Plug-in Version
{
"name": "sublime-js-prettier",
"version": "1.34.1",
"description": "JsPrettier is a Sublime Text Plug-in for Prettier, the opinionated code formatter.",
"author": "Jon LaBelle",
"license": "MIT",
"dependencies": {
"prettier": "latest"
},
"repository": "jonlabelle/SublimeJsPrettier",
"keywords": [
"sublime",
"sublimetext",
"plugin",
"prettier",
"jsprettier",
"formatter",
"javascript",
"css"
],
"files": [
"*.md",
".no-sublime-package",
"Context.sublime-menu",
"JsPrettier.py",
"JsPrettier.sublime-commands",
"jsprettier/**",
"Main.sublime-menu",
"messages.json",
"messages/*.txt"
],
"bugs": {
"url": "https://github.com/jonlabelle/SublimeJsPrettier/issues"
},
"homepage": "https://github.com/jonlabelle/SublimeJsPrettier"
}
Platform Details
Sublime Text Version: 3.2.2 Sublime Text Build: 3211 OS: OSX OS Version: Catalina 10.15.7 OS Architecture: Unknown
Generated Prettier command line arguments
-----------------------------------------
JsPrettier DEBUG - Prettier CLI Command
-----------------------------------------
/Users/lknecht/.nvm/versions/node/v12.17.0/bin/prettier --no-config --print-width 120 --tab-width 4 --single-quote false --trailing-comma none --bracket-spacing true --jsx-bracket-same-line false --parser babel --semi true --require-pragma false --prose-wrap preserve --arrow-parens always --html-whitespace-sensitivity css --quote-props as-needed --vue-indent-script-and-style false --embedded-language-formatting auto --jsx-single-quote false --use-tabs false --stdin-filepath /Users/lknecht/Repositories/project-api/test/unit/testruns_controller.test.js --loglevel debug --cursor-offset 10603
Prettier reported the following output:
[debug] normalized argv: {"_":[],"bracket-spacing":true,"color":true,"editorconfig":true,"jsx-bracket-same-line":false,"jsx-single-quote":false,"require-pragma":false,"semi":true,"single-quote":false,"use-tabs":false,"vue-indent-script-and-style":false,"config":false,"print-width":120,"tab-width":4,"trailing-comma":"none","parser":"babel","prose-wrap":"preserve","arrow-parens":"always","html-whitespace-sensitivity":"css","quote-props":"as-needed","embedded-language-formatting":"auto","stdin-filepath":"/Users/lknecht/Repositories/project-api/test/unit/testruns_controller.test.js","loglevel":"debug","cursor-offset":10603,"config-precedence":"cli-override","debug-repeat":0,"ignore-path":".prettierignore","plugin":[],"plugin-search-dir":[]}
[debug] '--no-config' option found, skip loading config file.
[debug] applied config-precedence (cli-override): {"filepath":"/Users/lknecht/Repositories/project-api/test/unit/testruns_controller.test.js","arrowParens":"always","bracketSpacing":true,"cursorOffset":10603,"embeddedLanguageFormatting":"auto","htmlWhitespaceSensitivity":"css","jsxBracketSameLine":false,"jsxSingleQuote":false,"parser":"babel","printWidth":120,"proseWrap":"preserve","quoteProps":"as-needed","requirePragma":false,"semi":true,"singleQuote":false,"tabWidth":4,"trailingComma":"none","useTabs":false,"vueIndentScriptAndStyle":false}
Is the same behavior observed when run against Prettier directly?
Unknown
The contents of your User/JsPrettier.sublime-settings
file
{
"debug": "true",
"prettier_cli_path": "/Users/lknecht/.nvm/versions/node/v12.17.0/bin/prettier",
"auto_format_on_save": true,
"custom_file_extensions": ["sublime-keymap", "sublime-settings", "yaml"],
"prettier_options": {
"printWidth": 120,
"tabWidth": 4,
"trailingComma": "none"
}
}
The contents of your <project_name>.sublime-project
file (if applicable)
N/A
Steps to reproduce the behavior
- Make Project
- Add
.prettierrc.yaml
- Add Configurations
- Save
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Configuration File - Prettier
The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a...
Read more >Prettier vscode extension ignoring config files - Stack Overflow
It seems that the VSCode prettier extension uses the config file in the VSCode settings over the local one, even if that config...
Read more >Location detection logic differs between .prettierignore and ...
Summary I have one directory where I put all my Git projects. Let's say it's called workspace. I open this in VS Code...
Read more >How to configure Prettier and VSCode - Gleb Bahmutov
You can configure JavaScript code auto-formatting with Prettier to work per-project. This allows you to get a consistent formatting without ...
Read more >Settings | JetBrains Fleet Documentation
Workspace settings take precedence over user settings. For this reason, it is recommended to only use them for configuration that makes sense ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@loganknecht have you try restart ST? For me, after checkout the debug message, I find that
--no-config
param was passed to prettier. I guess it happen because I created.prettierrc
after I ran prettier. Restart ST fix that issue for me.This issue has been automatically locked due to inactivity. Please open a new issue for related bugs.