This package has been deprecated

Author message:

Please use Prettier 2 directly if you want to reproduce the exact same settings you can use { "printWidth": 100, "singleQuote": true, "arrowParens": "avoid", "trailingComma": "all" } in your prettier config.

@open-wc/prettier-config

1.1.0 • Public • Published

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.

Setup

npm init @open-wc
# Upgrade > Linting

Manual

  • 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": [
        "eslint-config-prettier"
      ]
    },
    "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

Usage

Run:

  • 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

test/set-card.test.js
test/set-game.test.js
↑↑ these files are not prettier formatted ↑↑

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

<script> export default { mounted() { const editLink = document.querySelector('.edit-link a'); if (editLink) { const url = editLink.href; editLink.href = url.substr(0, url.indexOf('/master/')) + '/master/packages/prettier-config/README.md'; } } } </script>

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i @open-wc/prettier-config

Weekly Downloads

894

Version

1.1.0

License

MIT

Unpacked Size

8.6 kB

Total Files

5

Last publish

Collaborators

  • passle
  • d4kmor
  • larsdenbakker
  • modern-web