Ver código fonte

style: configure prettier

Jonas Gloning 2 anos atrás
pai
commit
fad2041a5e
5 arquivos alterados com 55 adições e 0 exclusões
  1. 23 0
      .github/workflows/prettier.yml
  2. 5 0
      .prettierignore
  3. 3 0
      .prettierrc.toml
  4. 22 0
      package-lock.json
  5. 2 0
      package.json

+ 23 - 0
.github/workflows/prettier.yml

@@ -0,0 +1,23 @@
+# From https://til.simonwillison.net/github-actions/prettier-github-actions
+name: Check JavaScript for conformance with Prettier
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  prettier:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check out repo
+        uses: actions/checkout@v3
+      - uses: actions/cache@v3
+        name: Configure npm caching
+        with:
+          path: ~/.npm
+          key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/prettier.yml') }}
+          restore-keys: |
+            ${{ runner.os }}-npm-
+      - name: Run prettier
+        run: |-
+          npx prettier --check .

+ 5 - 0
.prettierignore

@@ -0,0 +1,5 @@
+dist
+coverage
+
+# semantic-release
+CHANGELOG.md

+ 3 - 0
.prettierrc.toml

@@ -0,0 +1,3 @@
+trailingComma = "all"
+semi = true
+useTabs = true

+ 22 - 0
package-lock.json

@@ -39,6 +39,7 @@
         "jest": "^29.4.2",
         "mock-socket": "^9.1.5",
         "parcel": "^2.8.2",
+        "prettier": "^2.8.4",
         "semantic-release": "^20.0.0",
         "typescript": "^4.1.2"
       },
@@ -12098,6 +12099,21 @@
         "node": ">= 0.8.0"
       }
     },
+    "node_modules/prettier": {
+      "version": "2.8.4",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz",
+      "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==",
+      "dev": true,
+      "bin": {
+        "prettier": "bin-prettier.js"
+      },
+      "engines": {
+        "node": ">=10.13.0"
+      },
+      "funding": {
+        "url": "https://github.com/prettier/prettier?sponsor=1"
+      }
+    },
     "node_modules/pretty-format": {
       "version": "29.4.2",
       "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.2.tgz",
@@ -22948,6 +22964,12 @@
       "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
       "dev": true
     },
+    "prettier": {
+      "version": "2.8.4",
+      "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz",
+      "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==",
+      "dev": true
+    },
     "pretty-format": {
       "version": "29.4.2",
       "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.4.2.tgz",

+ 2 - 0
package.json

@@ -61,6 +61,7 @@
     "module": {}
   },
   "scripts": {
+    "format": "prettier --write .",
     "build": "parcel build",
     "lint": "eslint --ext .js,.ts . && npm run check",
     "check": "tsc --noEmit",
@@ -98,6 +99,7 @@
     "jest": "^29.4.2",
     "mock-socket": "^9.1.5",
     "parcel": "^2.8.2",
+    "prettier": "^2.8.4",
     "semantic-release": "^20.0.0",
     "typescript": "^4.1.2"
   }