Narcoleptic Programmers' Medicine

    @sixfold/editor-config
    TypeScript icon, indicating that this package has built-in type declarations

    2.2.2 • Public • Published

    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));

    Keywords

    none

    Install

    npm i @sixfold/editor-config

    DownloadsWeekly Downloads

    429

    Version

    2.2.2

    License

    MIT

    Unpacked Size

    3.75 kB

    Total Files

    6

    Last publish

    Collaborators

    • hannes-sixfold
    • aleksandrsvel
    • katlinteern
    • crinne
    • rein6f
    • hikmat-sf
    • merilymurd
    • sanderkadajane
    • imorfie
    • poolik
    • villesokk
    • freddylattekivi
    • henri
    • kaarelm
    • sixfold-build
    • riston
    • kaaarelkybar
    • jurasan
    • meelis
    • joonasvali
    • jaakla
    • tambet
    • joras
    • antonpotapchuk
    • v2rv
    • jaakalo
    • alinavorontseva
    • lkallas
    • raulokva
    • dmitrigb
    • tasyp
    • rolandkender
    • taivokasper
    • kaarelmetsaots
    • kekekeke
    • mmisin
    • coldb
    • marten.veskimae
    • artjomkozmik
    • henrpe
    • rkppl
    • kr1stine
    • rsellip
    • andrikaro
    • martenteino
    • karlriis