Skip to content

Instantly share code, notes, and snippets.

@cyjico
Last active November 21, 2024 13:09
Show Gist options
  • Save cyjico/c647dde852ac48e58779dc5ae0b8f9d8 to your computer and use it in GitHub Desktop.
Save cyjico/c647dde852ac48e58779dc5ae0b8f9d8 to your computer and use it in GitHub Desktop.
How-to file for integrating Prettier with ESLint for Visual Studio Code

Integrating Prettier with ESLint

Integrating Prettier with ESLint for Visual Studio Code.

Prerequsities:

  1. Install Prettier and prettier-eslint

    npm install --save-dev --save-exact prettier prettier-eslint
  2. Create your .prettierignore and .prettierrc

    For Linux:

    cat <<EOF > .prettierrc
    {}
    EOF
    
    cat <<EOF > .prettierignore
    # Ignore artifacts
    
    build
    coverage
    EOF

    For Windows:

    Set-Content -Path .prettierrc -Value "{}"
    @"
    # Ignore artifacts
    
    build
    coverage
    "@ | Set-Content -Path .prettierignore
  3. Install eslint-config-prettier

  4. If you're using TypeScript, install @types/eslint-config-prettier

  5. Reload your window (Ctrl + Shift + P => "Developer: Reload Window")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment