Détail du package

@open-wc/prettier-config

open-wc9.8kMITobsolète1.1.0

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.

Prettier config following open-wc recommendations

prettier, linting, formatting, config

readme

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>

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.1.0 (2020-04-20)

Features

  • prettier-config: update to prettier v2 (908013c)

0.1.14 (2020-02-09)

Bug Fixes

  • update linting docu to updates in package.json (e58015c)

0.1.13 (2019-12-08)

Note: Version bump only for package @open-wc/prettier-config

0.1.12 (2019-11-03)

Bug Fixes

0.1.11 (2019-10-23)

Bug Fixes

0.1.10 (2019-04-14)

Bug Fixes

0.1.9 (2019-03-13)

Bug Fixes

  • create: generated prettier scripts should work on windows (438a319)

0.1.8 (2019-03-08)

Note: Version bump only for package @open-wc/prettier-config

0.1.7 (2019-02-16)

Bug Fixes

  • update package repository fields with monorepo details (cb1acb7)

0.1.6 (2019-02-02)

Bug Fixes

  • unify npm readme header for all open-wc packages (1bac939)

0.1.5 (2019-01-26)

Bug Fixes

  • align all open-wc readme headers (b589429)

0.1.4 (2019-01-20)

Bug Fixes

0.1.3 (2019-01-19)

Bug Fixes

  • restructure menu and improve docu (dd37e22)

0.1.2 (2019-01-16)

Bug Fixes

0.1.1 (2018-12-20)

Bug Fixes

  • linting generators & documentation (5c29f7a)

0.1.0 (2018-12-12)

Features

  • prettier-config: add prettier and eslint-config-prettier (c0c359a)