@magic/format

@magic/format

run prettier and format your code.

install

be in a nodejs project.

npm i --save-dev --save-exact @magic/format

Usage

npm run scripts

Add the @magic/test bin scripts to package.json

{  "scripts": {    "format": "f -w",    "format:check": "f"  },  "devDependencies": {    "@magic/format": "0.0.1"  }}

then use the npm run scripts

npm run formatnpm run format:check

cli

// first install globallynpm i -g @magic/format// check formatting using prettier but do not write// prettier --list-differentf// format files using prettier// prettier --writef -w

plugins

@magic/format supports the following prettier plugins:

  • haml: @prettier/plugin-haml
  • lua: @prettier/plugin-lua
  • php: @prettier/plugin-php
  • pug: @prettier/plugin-pug
  • py: @prettier/plugin-python
  • rb: @prettier/plugin-ruby
  • gemspec: @prettier/plugin-ruby
  • xml: @prettier/plugin-xml
  • toml: @voltiso/prettier-plugin-toml
  • astro: prettier-plugin-astro
  • java: prettier-plugin-java
  • svelte: prettier-plugin-svelte
  • glsl: prettier-plugin-glsl
  • tailwind: prettier-plugin-tailwindcss