lgk-prettier

1.0.3 • Public • Published

LGK's Prettier config

Run

npx -y lgk-prettier

add the root of a project to add a .prettierrc file to it.

Add VS Code settings and extension

Adding the parameter --vscode or -c will also add this to the workspace:

  • .vscode/settings.json with "editor.formatOnSave": true
  • .vscode/settings.json with "recommendations": ["esbenp.prettier-vscode"]

Status

npm version

Why does this exist?

I like to use Prettier in all my projects to make code formatted in a consistent way. I configured my VS Code to format automatically with the Prettier extension.

I also wrote an article about this. It's in German though.

Graphic visualizing pretty formatting a code

Unfortunately I don't like the default formatting, so I always have my own .prettierc in each project, since you can't have a global Prettier config.

This script should help adding this config to a new project.

My preferred config looks like this:

{
    "tabWidth": 4,
    "useTabs": false,
    "semi": false,
    "singleQuote": false,
    "trailingComma": "none",
    "bracketSpacing": true,
    "bracketSameLine": false,
    "fluid": false
}

If you like this as well, feel free to use my command tool. Or fork this repo and change it to your own.

Package Sidebar

Install

npm i lgk-prettier

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

5.28 kB

Total Files

4

Last publish

Collaborators

  • lgkonline