Comments (6)
Hi @mitermayer. I tried using a .prettierrc
file in my home directory as you mentioned but it doesn't seem to be picked up. If I move it next to the JS file it works as expected. Does this feature depend on all the user's code being under the home directory perhaps?
from vim-prettier.
Hi @dchang-dchang,
Thank you for your kind words. The reason why we differ from prettier is because we are also used internally at Facebook and we follow the Facebook prettier configuration format (https://github.com/prettier/eslint-plugin-prettier#options).
You can update the default vim-prettier
settings to better suit your company/project by either updating your .vimrc
configuration or by even creating a ~/.prettierrc
on your home directory or adding custom project configurations on the format supported by the prettier
cli on your project.
Feel free to comment in this issue if you have any further questions around it.
from vim-prettier.
@mitermayer Thanks for the quick reply! That makes a lot of sense - was noticing that vim-prettier matched react's prettier flags.
Mind if I ask a newbie question? How do you manage differing prettier configurations across projects?
Let's say I want to contribute to Yarn and also React and they have different prettier settings. Do you manually edit .vimrc
every time you change between these project folders? Or do you just keep vim-prettier one way and then rely on pre-commit hooks that run the project's prettier to undo what vim-prettier changed?
from vim-prettier.
No need to respond. Found the answer to my own question. Did not know that vi had project specific settings!
http://vim.wikia.com/wiki/Project_specific_settings
from vim-prettier.
@dchang-dchang looks like vim-prettier
respects project-specific .prettierrc
(at least in the current directory), even overriding options set via let g:prettier#config#[...]
in ~/.vimrc
. So you don't have to go to the trouble of using vim's own project-specific settings mechanism
from vim-prettier.
Hi @masaeeudu,
The code used to find where configuration files exists are from prettier itself not from vim-prettier, it should work.
If you try to run prettier from the command line on the same directory does that work for you ?
The prettier resolution path to find configuration files is to look recursively among parents until finding the config. Is there a chance that you may be editing a file in a directory not inside your home directory?
from vim-prettier.
Related Issues (20)
- feature request to disable automatic mappings set by the plugin
- .eslintrc is ignored
- prettier hang on formatting a bigger file
- MacOS Monterey M1 plugin not loaded
- When endOfLine option set to 'crlf', ^M appear at the end of each line
- Prettier: failed to parse buffer — on mixed HTML/PHP file HOT 1
- Formatting on save stop when saving again
- Deletes comments in Ruby files HOT 3
- The same prettier doesn't work correctly on WSL
- plugin didn't work without installing eslint-config-prettier & eslint-plugin-prettier
- Request: check for filetype javascript (not just the .js and .jsx extensions) HOT 1
- Prettier auto format on Save not working. HOT 1
- Why prettier keeps adding warn messages on top of my document? HOT 16
- Deprecated / Unknown options when using Prettier v3 HOT 3
- Keep show warning after save! HOT 1
- Error while resolving package dependencies HOT 3
- Error on manual trigger
- prettier runs with incorrect prettier configuration HOT 2
- Vim-Prettier is using its own defaults, not the defaults from prettier (in my case, trailingComma)
- `Failed to parse buffers` for Ruby files. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-prettier.