millermedeiros / esformatter

ECMAScript code beautifier/formatter
MIT License
970 stars 91 forks source link

how can i learn how i work with esformatter config like (indent, lineBreak, whiteSpace) #494

Open derakhshanfar opened 6 years ago

derakhshanfar commented 6 years ago

Hi guys, First of all thanks a ton for making this amazing library, but I don't know how can I work with this config's, for example when I see some like bellow I can't understand what is it exactly! What is (before, after, ObjectExpression, ModuleSpecifier, ExportDefault and other bellow configs) ? What is -1, 0 2 and ..? Can you help me?

 "lineBreak": {
    "before": {
      "ObjectExpressionOpeningBrace": -1,
      "ObjectExpressionClosingBrace": -1,
      "Property": -1,
      "ExportAllDeclaration": 2,
      "ExportDefaultDeclaration": 2,
      "ExportNamedDeclaration": 2,
      "ModuleSpecifierClosingBrace": 1,
      "ModuleSpecifierComma": 0
    },
    "after": {
      "ModuleSpecifierComma": -1,
      "ObjectExpressionOpeningBrace": -1,
      "ObjectExpressionClosingBrace": -1,
      "Property": -1,
      "ExportAllDeclaration": 2,
      "ExportDefaultDeclaration": 2,
      "ExportNamedDeclaration": 2,
      "ImportDeclaration": 2,
      "ModuleSpecifierOpeningBrace": 1,
      "ModuleSpecifierClosingBrace": -1,
      "ModuleSpecifierComma": 1
    }
  },
  "whiteSpace": {
    "before": {
      "ObjectExpressionClosingBrace": 1
    },
    "after": {
      "MethodName": 1,
      "ObjectExpressionOpeningBrace": 1,
      "PropertyValue": -1
    }
  }