-1

How do you set configuration variables? I'm able to prettify my PHP code on save, but I have no idea where i should put plugin-specific values as they're defined here https://github.com/prettier/plugin-php#configuration

orfaust
  • 67
  • 4

1 Answers1

-1

Prettier uses cosmiconfig for configuration file support. This means you can configure Prettier via (in order of precedence)

  • A "prettier" key in your package.json file.
  • A .prettierrc file written in JSON or YAML.
  • A .prettierrc.json, .prettierrc.yml, .prettierrc.yaml, or .prettierrc.json5 file.
  • A .prettierrc.js, .prettierrc.cjs, prettier.config.js, or prettier.config.cjs file that exports an object using module.exports.
  • A .prettierrc.toml file.

The configuration file will be resolved starting from the location of the file being formatted, and searching up the file tree until a config file is (or isn’t) found.

Prettier intentionally doesn’t support any kind of global configuration. This is to make sure that when a project is copied to another computer, Prettier’s behavior stays the same. Otherwise, Prettier wouldn’t be able to guarantee that everybody in a team gets the same consistent results.

The options you can use in the configuration file are the same as the API options.

source: https://prettier.io/docs/en/configuration.html

orfaust
  • 67
  • 4
  • This answer doesn't make any sense. You can configure Prettier via... ??? There seems to be some key information missing - the actual answer. This is why link-only answers are generally not acceptable on Stack Exchange sites, including Stack Overflow. The link may change or become unreachable in the future, and without a summary of what the link contains this answer would be useless. Please summarize what is in the link (**don't** just copy and paste) and use the link solely for reference. ***If you remove the link and the answer cannot stand on its own, it is not a good answer.*** – MattDMo Nov 23 '21 at 21:50
  • @MattDMo oops I didn't realize that the answer wasn't complete... thank you – orfaust Nov 24 '21 at 14:21