piuccio / sublime-esformatter

JavaScript formatter plugin for Sublime Text
MIT License
28 stars 20 forks source link

How to use esformatter plugin in sublime text 3 #61

Closed huntout closed 8 years ago

huntout commented 8 years ago

my .esformatter file

{
  "preset": "default",

  "plugins": [
    "esformatter-add-trailing-commas",
    "esformatter-quotes",
  ],

  "pipe": {
    "after": [
      "es-strip-semicolons",
    ],
  },

  "quotes": {
    "type": "single",
  },
}

my package.json file

{
  "devDependencies": {
    "es-strip-semicolons": "^1.0.6",
    "esformatter": "^0.8.2",
    "esformatter-add-trailing-commas": "^1.1.0",
    "esformatter-quotes": "^1.0.3",
  }
}

It seems the plugins not work.

piuccio commented 8 years ago

did you install esformatter globally? npm install -g esformatter

huntout commented 8 years ago

yes, I have installed esformatter glabally too.

hugomrdias commented 8 years ago

i have the same problem console shows this error

error: Error (1):Unable to format

huntout commented 8 years ago

I have resolved it.

cd "Sublime Text 3 x64\Data\Packages\EsFormatter\lib"
npm i -S esformatter esformatter-add-trailing-commas esformatter-quotes
npm run prepublish
andy9775 commented 8 years ago

@hugomrdias I had the same issue. Try adding the plugins that your .esformatter file declares to ~/Library/Application Support/Sublime Text 3/Packages/EsFormatter/lib by using npm i -S <package-name> then npm run prepublish

piuccio commented 8 years ago

As of 2.0.0 the plugin uses the local/global version of esformatter, it should be easier to configure your plugins.