GithubHelp home page GithubHelp logo

Comments (6)

masaeedu avatar masaeedu commented on May 19, 2024 1

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.

mitermayer avatar mitermayer commented on May 19, 2024

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.

dchang-dchang avatar dchang-dchang commented on May 19, 2024

@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.

dchang-dchang avatar dchang-dchang commented on May 19, 2024

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.

helixbass avatar helixbass commented on May 19, 2024

@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.

mitermayer avatar mitermayer commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.