Parcourir la source

meta: check for formatting in CI (#4714)

Antoine du Hamel il y a 1 an
Parent
commit
4b1bc4bcc3
3 fichiers modifiés avec 18 ajouts et 4 suppressions
  1. 2 0
      .github/workflows/linters.yml
  2. 12 4
      e2e/clients/index.html
  3. 4 0
      package.json

+ 2 - 0
.github/workflows/linters.yml

@@ -48,6 +48,8 @@ jobs:
           @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build
       - name: Run linter
         run: corepack yarn run lint
+      - name: Run Prettier
+        run: corepack yarn run format:check-diff
 
   lint_md:
     name: Lint Markdown

+ 12 - 4
e2e/clients/index.html

@@ -1,7 +1,7 @@
 <!doctype html>
 <html lang="en">
   <head>
-    <meta charset="utf-8"/>
+    <meta charset="utf-8" />
     <title>End-to-End test suite</title>
   </head>
   <body>
@@ -9,10 +9,18 @@
     <nav>
       <ul>
         <li><a href="dashboard-aws/index.html">dashboard-aws</a></li>
-        <li><a href="dashboard-aws-multipart/index.html">dashboard-aws-multipart</a></li>
-        <li><a href="dashboard-compressor/index.html">dashboard-compressor</a></li>
+        <li>
+          <a href="dashboard-aws-multipart/index.html"
+            >dashboard-aws-multipart</a
+          >
+        </li>
+        <li>
+          <a href="dashboard-compressor/index.html">dashboard-compressor</a>
+        </li>
         <li><a href="react/index.html">react</a></li>
-        <li><a href="dashboard-transloadit/index.html">dashboard-transloadit</a></li>
+        <li>
+          <a href="dashboard-transloadit/index.html">dashboard-transloadit</a>
+        </li>
         <li><a href="dashboard-tus/index.html">dashboard-tus</a></li>
         <li><a href="dashboard-xhr/index.html">dashboard-xhr</a></li>
         <li><a href="dashboard-ui/index.html">dashboard-ui</a></li>

+ 4 - 0
package.json

@@ -134,6 +134,10 @@
     "lint:css": "stylelint ./packages/**/*.scss",
     "lint:css:fix": "stylelint ./packages/**/*.scss --fix",
     "lint": "eslint . --cache",
+    "format:show-diff": "git diff --quiet || (echo 'Unable to show a diff because there are unstaged changes'; false) && (prettier . -w --loglevel silent && git --no-pager diff; git restore .)",
+    "format:check": "prettier -c .",
+    "format:check-diff": "yarn format:check || (yarn format:show-diff && false)",
+    "format": "prettier -w .",
     "release": "PACKAGES=$(yarn workspaces list --json) yarn workspace @uppy-dev/release interactive",
     "size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c",
     "e2e": "yarn build && yarn e2e:skip-build",