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