Prettier config following open-wc recommendations

Usage no npm install needed!

<script type="module">
  import openWcPrettierConfig from 'https://cdn.skypack.dev/@open-wc/prettier-config';


Linting Prettier

Use Prettier to format your JS, CSS and HTML code.

:Warning: this package is deprecated. We recommend using prettier v2 with the recommend config instead.


npm init @open-wc
# Upgrade > Linting


  • Install @open-wc/prettier-config
    npm add --save-dev @open-wc/prettier-config
  • Adjust your package.json with the following
    "scripts": {
      "lint:prettier": "prettier \"**/*.js\" --check --ignore-path .gitignore",
      "format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore"
    "devDependencies": {
      "@open-wc/prettier-config": "^0.1.10"
    "eslintConfig": {
      "extends": [
    "prettier": "@open-wc/prettier-config"

What you get

  • Apply formatting to JS files
  • Apply formatting to HTML inside of html tagged template literals used by lit-html
  • Apply formatting to CSS inside of css tagged template literals used by lit-element
  • Integration with ESLint to prevent potentially conflicting rules



  • npm run lint:prettier to check if your files are correctly formatted
  • npm run format:prettier to auto format your files

Linting Error Examples

$ npm run lint:prettier

↑↑ these files are not prettier formatted ↑↑

Simply run npm run format:prettier to format your files automatically.