Integrating Prettier with ESLint for Visual Studio Code.
Prerequsities:
- ESLint (At the moment, the VS Code extension only works with
[email protected]
and below) - Prettier ESLint VS Code Extension
-
Install Prettier and prettier-eslint
npm install --save-dev --save-exact prettier prettier-eslint
-
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
-
Install eslint-config-prettier
-
If you're using TypeScript, install @types/eslint-config-prettier
-
Reload your window (
Ctrl + Shift + P => "Developer: Reload Window"
)