title: automatically formatting code with prettier with onchange not working
body: <p>i want to format the file with prettier whenever the file changes. So i run this command to achieve that</p>
  
  <pre><code>onchange '**/*.js' -- prettier --write {{changed}}
  </code></pre>
  
  <p>This works absolutely fine when run through terminal, listen file changes and formats it.</p>
  
  <p>But when i add this command as npm script in package.json it and execute it with <code>npm run prettier-watch</code></p>
  
  <p>it starts listening to changes but it doesn't format code when file is changed.</p>
  
  <p>package.json</p>
  
  <pre><code>{
    "name": "pwa-svelte-rollup-template",
    "private": true,
    "scripts": {
      "start": "run-p serve autobuild",
      "serve": "sirv public --dev",
      "build": "rollup -c",
      "autobuild": "rollup -c -w",
      "clean": "rimraf public/bundle.*",
      "prettier-watch": "onchange '**/*.js' -- prettier --write {{changed}}"
    },
    "devDependencies": {
      "@babel/core": "^7.5.5",
      "@babel/plugin-proposal-class-properties": "^7.5.5",
      "@babel/preset-env": "^7.5.5",
      "babel-core": "^7.0.0-bridge.0",
      "babel-eslint": "^10.0.2",
      "babel-jest": "^24.8.0",
      "eslint": "^6.1.0",
      "eslint-config-standard": "^13.0.1",
      "eslint-plugin-import": "^2.18.2",
      "eslint-plugin-jest": "^22.14.0",
      "eslint-plugin-node": "^9.1.0",
      "eslint-plugin-promise": "^4.2.1",
      "eslint-plugin-standard": "^4.0.0",
      "node-sass": "^4.12.0",
      "npm-run-all": "^4.1.5",
      "onchange": "^6.0.0",
      "prettier": "^1.18.2",
      "rimraf": "^2.6.3",
      "rollup": "^1.17.0",
      "rollup-plugin-babel": "^4.3.3",
      "rollup-plugin-commonjs": "^10.0.1",
      "rollup-plugin-livereload": "^1.0.1",
      "rollup-plugin-node-resolve": "^5.2.0",
      "rollup-plugin-svelte": "^5.1.0",
      "rollup-plugin-terser": "^5.1.1",
      "sirv-cli": "^0.4.4",
      "svelte": "^3.6.9",
      "svelte-preprocess-sass": "^0.2.0"
    },
    "babel": {
      "presets": [
        [
          "@babel/preset-env",
          {
            "useBuiltIns": "entry",
            "corejs": "3.0.0"
          }
        ]
      ],
      "plugins": [
        [
          "@babel/plugin-proposal-class-properties"
        ]
      ],
      "sourceMaps": true
    },
    "browserslist": [
      "last 2 versions",
      "not dead",
      "not IE 11",
      "not &lt; 0.2%"
    ],
    "eslintConfig": {
      "extends": [
        "standard"
      ],
      "env": {
        "browser": true,
        "serviceworker": true,
        "jest": true
      },
      "parser": "babel-eslint",
      "parserOptions": {
        "ecmaVersion": 8,
        "ecmaFeatures": {
          "experimentalObjectRestSpread": true
        },
        "sourceType": "module"
      }
    },
    "eslintIgnore": [
      ".cache",
      "dist",
      "node_modules"
    ]
  }
  
  </code></pre>
  
  <p>please tell me if i am doing something wrong</p>