From eb32b1bf09f94e40575066ea21b7e79c9a151ee0 Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Wed, 27 Sep 2023 17:09:47 +0200
Subject: [PATCH 1/8] meta: add Prettier
JS files are ignored for now because we want to migrate them to TS
anyway.
---
.eslintrc.js | 7 ++++++-
.prettierignore | 7 +++++++
.prettierrc.js | 6 ++++++
package.json | 7 ++++++-
yarn.lock | 10 ++++++++++
5 files changed, 35 insertions(+), 2 deletions(-)
create mode 100644 .prettierignore
create mode 100644 .prettierrc.js
diff --git a/.eslintrc.js b/.eslintrc.js
index 84b9bee40b..40920c37fa 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -54,6 +54,12 @@ module.exports = {
ignore: svgPresentationAttributes,
}],
+ // Rules that conflict with Prettier
+ 'space-before-function-paren': 'off',
+ 'nonblock-statement-body-position': 'off',
+ 'operator-linebreak': 'off',
+ 'implicit-arrow-linebreak': 'off',
+
// Special rules for CI:
...(process.env.CI && {
// Some imports are available only after a full build, which we don't do on CI.
@@ -63,7 +69,6 @@ module.exports = {
// rules we want to enforce
'array-callback-return': 'error',
'func-names': 'error',
- 'implicit-arrow-linebreak': 'error',
'import/no-dynamic-require': 'error',
'import/no-extraneous-dependencies': 'error',
'max-len': 'error',
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000000..cfebd2d979
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,7 @@
+node_modules/
+*.js
+*.jsx
+*.cjs
+*.mjs
+*.md
+*.lock
diff --git a/.prettierrc.js b/.prettierrc.js
new file mode 100644
index 0000000000..ce60d4e940
--- /dev/null
+++ b/.prettierrc.js
@@ -0,0 +1,6 @@
+module.exports = {
+ proseWrap: 'always',
+ singleQuote: true,
+ trailingComma: 'all',
+ semi: false,
+};
diff --git a/package.json b/package.json
index cd91bcc182..6a06faf53c 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,11 @@
"description": "Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
"lint-staged": {
"*.{js,mjs,cjs,jsx}": "eslint --fix",
- "*.{ts,mts,cts,tsx}": "eslint --fix",
+ "*.{ts,mts,cts,tsx}": [
+ "eslint --fix",
+ "prettier -w"
+ ],
+ "*.{json,yaml,yml,scss,vue}": "prettier -w",
"*.md": [
"remark --silently-ignore -i .remarkignore -foq",
"eslint --fix"
@@ -91,6 +95,7 @@
"postcss-dir-pseudo-class": "^6.0.0",
"postcss-logical": "^5.0.0",
"pre-commit": "^1.2.2",
+ "prettier": "^3.0.3",
"remark-cli": "^11.0.0",
"resolve": "^1.17.0",
"sass": "^1.29.0",
diff --git a/yarn.lock b/yarn.lock
index 56d8613c7f..3e242f6754 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9074,6 +9074,7 @@ __metadata:
postcss-dir-pseudo-class: ^6.0.0
postcss-logical: ^5.0.0
pre-commit: ^1.2.2
+ prettier: ^3.0.3
remark-cli: ^11.0.0
resolve: ^1.17.0
sass: ^1.29.0
@@ -26290,6 +26291,15 @@ __metadata:
languageName: node
linkType: hard
+"prettier@npm:^3.0.3":
+ version: 3.0.3
+ resolution: "prettier@npm:3.0.3"
+ bin:
+ prettier: bin/prettier.cjs
+ checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0
+ languageName: node
+ linkType: hard
+
"pretty-bytes@npm:^5.3.0, pretty-bytes@npm:^5.6.0":
version: 5.6.0
resolution: "pretty-bytes@npm:5.6.0"
From 002053bcd30234b98049856df4530d5549f6e702 Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Thu, 28 Sep 2023 12:45:12 +0200
Subject: [PATCH 2/8] fixup
---
.prettierrc.js | 6 ++
e2e/clients/index.html | 18 +++--
examples/transloadit/index.html | 114 +++++++++++++++++++++-----------
3 files changed, 94 insertions(+), 44 deletions(-)
diff --git a/.prettierrc.js b/.prettierrc.js
index ce60d4e940..f4cecc697c 100644
--- a/.prettierrc.js
+++ b/.prettierrc.js
@@ -3,4 +3,10 @@ module.exports = {
singleQuote: true,
trailingComma: 'all',
semi: false,
+ overrides: [{
+ files: "packages/@uppy/angular/**",
+ options:{
+ semi: true,
+ },
+ }]
};
diff --git a/e2e/clients/index.html b/e2e/clients/index.html
index 05311bd03d..c4582008bf 100644
--- a/e2e/clients/index.html
+++ b/e2e/clients/index.html
@@ -1,7 +1,7 @@
-
+
End-to-End test suite
@@ -9,15 +9,23 @@
Test apps
-
+
-
+
-
+
Form with inline Dashboard
-
- You can also use the Dashboard UI inside a plain old HTML form.
-
-
-
+
Inline Dashboard
- The robodog.dashboard API allows you to embed a Dashboard at any location. Users can continuously upload files through this UI, so please make sure this fits your use case!
+ The robodog.dashboard API allows you to embed a Dashboard
+ at any location. Users can continuously upload files through this UI, so
+ please make sure this fits your use case!
-
+
Dashboard Modal
- This API is a one-shot upload UI using a modal overlay. Call the function and receive a listen to an event with upload results ✌️
+ This API is a one-shot upload UI using a modal overlay. Call the
+ function and receive a listen to an event with upload results ✌️
uppy.upload()
+
An <input type=file> backed by uppy.upload():
- An <input type=file> backed by uppy.upload():
-
-
-
+
-
+
From e7a4cfaff88ccfa64fd25a5e10beb36503edc12f Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Thu, 28 Sep 2023 12:50:26 +0200
Subject: [PATCH 3/8] use `eslint-config-prettier`
---
.eslintrc.js | 8 +-------
package.json | 1 +
yarn.lock | 12 ++++++++++++
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index 40920c37fa..a0e094f281 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -8,7 +8,7 @@ const svgPresentationAttributes = [
module.exports = {
root: true,
- extends: ['transloadit'],
+ extends: ['transloadit', 'prettier'],
env: {
es6: true,
jest: true,
@@ -54,12 +54,6 @@ module.exports = {
ignore: svgPresentationAttributes,
}],
- // Rules that conflict with Prettier
- 'space-before-function-paren': 'off',
- 'nonblock-statement-body-position': 'off',
- 'operator-linebreak': 'off',
- 'implicit-arrow-linebreak': 'off',
-
// Special rules for CI:
...(process.env.CI && {
// Some imports are available only after a full build, which we don't do on CI.
diff --git a/package.json b/package.json
index 6a06faf53c..bc22120919 100644
--- a/package.json
+++ b/package.json
@@ -66,6 +66,7 @@
"esbuild": "^0.17.1",
"esbuild-plugin-babel": "^0.2.3",
"eslint": "^8.0.0",
+ "eslint-config-prettier": "^9.0.0",
"eslint-config-transloadit": "^2.0.0",
"eslint-plugin-compat": "^4.0.0",
"eslint-plugin-cypress": "^2.12.1",
diff --git a/yarn.lock b/yarn.lock
index 3e242f6754..80bc9bdb30 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9045,6 +9045,7 @@ __metadata:
esbuild: ^0.17.1
esbuild-plugin-babel: ^0.2.3
eslint: ^8.0.0
+ eslint-config-prettier: ^9.0.0
eslint-config-transloadit: ^2.0.0
eslint-plugin-compat: ^4.0.0
eslint-plugin-cypress: ^2.12.1
@@ -15779,6 +15780,17 @@ __metadata:
languageName: node
linkType: hard
+"eslint-config-prettier@npm:^9.0.0":
+ version: 9.0.0
+ resolution: "eslint-config-prettier@npm:9.0.0"
+ peerDependencies:
+ eslint: ">=7.0.0"
+ bin:
+ eslint-config-prettier: bin/cli.js
+ checksum: 362e991b6cb343f79362bada2d97c202e5303e6865888918a7445c555fb75e4c078b01278e90be98aa98ae22f8597d8e93d48314bec6824f540f7efcab3ce451
+ languageName: node
+ linkType: hard
+
"eslint-config-transloadit@npm:^2.0.0":
version: 2.0.0
resolution: "eslint-config-transloadit@npm:2.0.0"
From 3d2a40724a31f18b43ae3afb5b8698f91d561ed7 Mon Sep 17 00:00:00 2001
From: Antoine du Hamel
Date: Thu, 28 Sep 2023 12:58:51 +0200
Subject: [PATCH 4/8] fixup
---
e2e/clients/index.html | 16 ++---
examples/transloadit/index.html | 112 +++++++++++---------------------
2 files changed, 42 insertions(+), 86 deletions(-)
diff --git a/e2e/clients/index.html b/e2e/clients/index.html
index c4582008bf..398cc569ae 100644
--- a/e2e/clients/index.html
+++ b/e2e/clients/index.html
@@ -1,7 +1,7 @@
-
+
End-to-End test suite
@@ -9,18 +9,10 @@
- This page contains small examples for different ways you can use Uppy
- with Transloadit. Please see the
- Github repository
- for the source code.
+ This page contains small examples for different ways you can use Uppy with Transloadit. Please see the Github repository for the source code.
-
+
Form
- The form API allows you to easily send files through Transloadit’s
- encoding backend. When the user submits the form, any files are uploaded
- to Transloadit. The form data is then sent to your own backend, with
- additional data about the Transloadit Assemblies that were started.
+ The form API allows you to easily send files through Transloadit’s encoding backend. When the user submits the form, any files are uploaded to Transloadit. The form data is then sent to your own backend, with additional data about the Transloadit Assemblies that were started.
-
+
Form with inline Dashboard
-
You can also use the Dashboard UI inside a plain old HTML form.
-
-
+
Inline Dashboard
- The robodog.dashboard API allows you to embed a Dashboard
- at any location. Users can continuously upload files through this UI, so
- please make sure this fits your use case!
+ The robodog.dashboard API allows you to embed a Dashboard at any location. Users can continuously upload files through this UI, so please make sure this fits your use case!
-
+
Dashboard Modal
- This API is a one-shot upload UI using a modal overlay. Call the
- function and receive a listen to an event with upload results ✌️
+ This API is a one-shot upload UI using a modal overlay. Call the function and receive a listen to an event with upload results ✌️
uppy.upload()
-
An <input type=file> backed by uppy.upload():
-
+ An <input type=file> backed by uppy.upload():
+