Do to set per-project settings on Atom?

0

I want to enable format-on-save (Prettier) on per project basis. I can do it globally, but how do I do that per project? I want developers to use the same formatting without forcing them enabling the global setting.

Paulius Liekis

Posted 2019-07-09T04:20:37.300

Reputation: 101

Answers

0

Have you looked at Prettier configuration files? These files should be put in the root of your project or included in you Node package manifest (package.json).

There are multiple options to choose from:

Prettier uses cosmiconfig for configuration file support. This means you can configure prettier via:

  • A .prettierrc file, written in YAML or JSON, with optional extensions:.yaml/.yml/.json`.
  • A .prettierrc.toml file, written in TOML (the .toml extension is *required ).
  • A prettier.config.js or .prettierrc.js file that exports an object.
  • A "prettier" key in your package.json file.

Configuration files are meant to be included in your VCS.

idleberg

Posted 2019-07-09T04:20:37.300

Reputation: 1 200

As far as I understand these configuration files tell Prettier how to format the code once it's enabled. I can't find a setting which would enable Prettier for one project, but not globally. VSCode has formatOnSave setting which can be set in the project (.vscode/settins.json), but I can not find the same logic for Atom. – Paulius Liekis – 2019-07-09T11:37:30.563