@sixfold/editor-config

Add the following line in the target service's package.json:

Usage no npm install needed!

<script type="module">
  import sixfoldEditorConfig from 'https://cdn.skypack.dev/@sixfold/editor-config';
</script>

README

editor-config

How to use Prettier

  1. Add the following line in the target service's package.json:
"prettier": "@sixfold/editor-config/prettier"
  1. Add the following scripts to your package.json
  "prettier": "prettier \"./src/**/**\"",
  "prettier:check": "yarn prettier --check",
  "prettier:fix": "yarn prettier --write",
  1. Add a .prettierignore file at the source of the repository, containing at least the following:
package.json
.DS_Store

Make sure to include .prettierignore in your docker (test) if you check prettier formatting as part of the tests.

  1. Configure your IDE to use Prettier:
  • VSCode
  • WebStorm (Should be installed by default, but you need to configure it.)
  1. Add yarn prettier:check as part of the test or build script to ensure that code is consistently formatted

Using prettier config with prettier APIs

When generating code programmatically, same configuration can be used to format generated output:

import * as prettier from 'prettier';
import * as prettierConfig from '@sixfold/editor-config';

const source = 'function main(){console.log("Hello")};main()';

console.log(prettier.format(source, prettierConfig));