From 588bfb515e09d3a23f367a9303c28f9ddadfb547 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 24 Jan 2024 11:37:01 +0100 Subject: [PATCH] meta: prettier 3.0.3 -> 3.2.4 (#4889) Notable change: https://prettier.io/blog/2023/11/13/curious-ternaries --- .vscode/uppy.code-workspace | 54 +++++++++---------- e2e/tsconfig.json | 4 +- .../src/app/app.component.html | 4 +- examples/angular-example/tsconfig.json | 6 +-- examples/svelte-example/tsconfig.json | 2 +- package.json | 10 ++-- packages/@uppy/angular/tsconfig.json | 8 +-- .../@uppy/audio/src/PermissionsScreen.tsx | 6 +-- packages/@uppy/audio/src/RecordingScreen.tsx | 6 +-- .../audio/src/audio-oscilloscope/index.ts | 8 +-- packages/@uppy/audio/tsconfig.json | 12 ++--- packages/@uppy/companion/tsconfig.json | 4 +- packages/@uppy/core/src/Uppy.test.ts | 6 +-- packages/@uppy/core/src/Uppy.ts | 32 +++++------ packages/@uppy/core/tsconfig.json | 12 ++--- packages/@uppy/image-editor/tsconfig.json | 12 ++--- packages/@uppy/locales/tsconfig.json | 10 ++-- packages/@uppy/status-bar/src/Components.tsx | 20 +++---- packages/@uppy/status-bar/src/StatusBar.tsx | 12 ++--- packages/@uppy/status-bar/src/StatusBarUI.tsx | 20 ++++--- packages/@uppy/status-bar/tsconfig.json | 12 ++--- packages/@uppy/store-default/tsconfig.json | 4 +- packages/@uppy/svelte/tsconfig.json | 4 +- packages/@uppy/utils/src/findDOMElement.ts | 4 +- .../utils/webkitGetAsEntryApi/index.ts | 15 +++--- packages/@uppy/utils/src/getFileType.ts | 5 +- packages/@uppy/utils/src/prettyETA.ts | 28 +++++----- packages/@uppy/utils/tsconfig.json | 4 +- packages/uppy/tsconfig.json | 4 +- private/js2ts/index.mjs | 6 +-- yarn.lock | 6 +-- 31 files changed, 174 insertions(+), 166 deletions(-) diff --git a/.vscode/uppy.code-workspace b/.vscode/uppy.code-workspace index 6666e589a7..918de6b366 100644 --- a/.vscode/uppy.code-workspace +++ b/.vscode/uppy.code-workspace @@ -1,29 +1,29 @@ { - "folders": [ - { - "path": ".." - } - ], - "settings": { - "workbench.colorCustomizations": { - "titleBar.activeForeground": "#ffffff", - "titleBar.activeBackground": "#ff009d", - }, - "search.exclude": { - "website/public/": true, - "node_modules/": true, - "website/node_modules/": true, - "dist/": true, - "lib/": true, - "package-lock.json": true, - "website/package-lock.json": true, - "yarn-error.log": true, - "website/.deploy_git": true, - "npm-debug.log": true, - "website/npm-debug.log": true, - "website/debug.log": true, - "nohup.out": true, - "yarn.lock": true - } - } + "folders": [ + { + "path": "..", + }, + ], + "settings": { + "workbench.colorCustomizations": { + "titleBar.activeForeground": "#ffffff", + "titleBar.activeBackground": "#ff009d", + }, + "search.exclude": { + "website/public/": true, + "node_modules/": true, + "website/node_modules/": true, + "dist/": true, + "lib/": true, + "package-lock.json": true, + "website/package-lock.json": true, + "yarn-error.log": true, + "website/.deploy_git": true, + "npm-debug.log": true, + "website/npm-debug.log": true, + "website/debug.log": true, + "nohup.out": true, + "yarn.lock": true, + }, + }, } diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json index 805336a76c..935e90ca6e 100644 --- a/e2e/tsconfig.json +++ b/e2e/tsconfig.json @@ -4,7 +4,7 @@ "noEmit": true, "target": "es2020", "lib": ["es2020", "dom"], - "types": ["cypress"] + "types": ["cypress"], }, - "include": ["cypress/**/*.ts"] + "include": ["cypress/**/*.ts"], } diff --git a/examples/angular-example/src/app/app.component.html b/examples/angular-example/src/app/app.component.html index 36092f8cbe..caa8e7d7d9 100644 --- a/examples/angular-example/src/app/app.component.html +++ b/examples/angular-example/src/app/app.component.html @@ -717,8 +717,8 @@

Next Steps

ng generate component xyz
-
ng add @angular/material
-
ng add @angular/pwa
+
ng add @angular/material
+
ng add @angular/pwa
ng add _____
ng test
ng build
diff --git a/examples/angular-example/tsconfig.json b/examples/angular-example/tsconfig.json index 1301bf238f..8901ce8c69 100644 --- a/examples/angular-example/tsconfig.json +++ b/examples/angular-example/tsconfig.json @@ -19,12 +19,12 @@ "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, - "lib": ["ES2022", "dom"] + "lib": ["ES2022", "dom"], }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, - "strictTemplates": true - } + "strictTemplates": true, + }, } diff --git a/examples/svelte-example/tsconfig.json b/examples/svelte-example/tsconfig.json index 47bdb60e94..67689d1f82 100644 --- a/examples/svelte-example/tsconfig.json +++ b/examples/svelte-example/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": {}, "esModuleInterop": true, "include": ["src/**/*"], - "exclude": ["node_modules/*", "__sapper__/*", "public/*"] + "exclude": ["node_modules/*", "__sapper__/*", "public/*"], } diff --git a/package.json b/package.json index 1dc6c8be4c..283f3f5b88 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "*.{js,mjs,cjs,jsx}": "eslint --fix", "*.{ts,mts,cts,tsx}": [ "eslint --fix", - "prettier -w", + "prettier --experimental-ternaries -w", "eslint" ], - "*.{css,html,json,scss,vue,yaml,yml}": "prettier -w", + "*.{css,html,json,scss,vue,yaml,yml}": "prettier --experimental-ternaries -w", "*.md": [ "remark --silently-ignore -i .remarkignore -foq", "eslint --fix" @@ -135,10 +135,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:show-diff": "git diff --quiet || (echo 'Unable to show a diff because there are unstaged changes'; false) && (prettier . --experimental-ternaries -w --loglevel silent && git --no-pager diff; git restore .)", + "format:check": "prettier --experimental-ternaries -c .", "format:check-diff": "yarn format:check || (yarn format:show-diff && false)", - "format": "prettier -w .", + "format": "prettier --experimental-ternaries -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:clean && yarn build && yarn e2e:skip-build", diff --git a/packages/@uppy/angular/tsconfig.json b/packages/@uppy/angular/tsconfig.json index ccfa195bcb..fb22302336 100644 --- a/packages/@uppy/angular/tsconfig.json +++ b/packages/@uppy/angular/tsconfig.json @@ -3,7 +3,7 @@ "compileOnSave": false, "compilerOptions": { "paths": { - "@uppy/angular": ["dist/uppy/angular"] + "@uppy/angular": ["dist/uppy/angular"], }, "baseUrl": "./", "outDir": "./dist/out-tsc", @@ -22,12 +22,12 @@ "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, - "lib": ["ES2022", "dom"] + "lib": ["ES2022", "dom"], }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, - "strictTemplates": true - } + "strictTemplates": true, + }, } diff --git a/packages/@uppy/audio/src/PermissionsScreen.tsx b/packages/@uppy/audio/src/PermissionsScreen.tsx index 89b0dede8e..50a15fb2ca 100644 --- a/packages/@uppy/audio/src/PermissionsScreen.tsx +++ b/packages/@uppy/audio/src/PermissionsScreen.tsx @@ -16,9 +16,9 @@ export default (props: PermissionsScreenProps): JSX.Element => { {hasAudio ? i18n('allowAudioAccessTitle') : i18n('noAudioTitle')}

- {hasAudio - ? i18n('allowAudioAccessDescription') - : i18n('noAudioDescription')} + {hasAudio ? + i18n('allowAudioAccessDescription') + : i18n('noAudioDescription')}

) diff --git a/packages/@uppy/audio/src/RecordingScreen.tsx b/packages/@uppy/audio/src/RecordingScreen.tsx index b9fb872315..5b82fbbd8d 100644 --- a/packages/@uppy/audio/src/RecordingScreen.tsx +++ b/packages/@uppy/audio/src/RecordingScreen.tsx @@ -91,11 +91,9 @@ export default function RecordingScreen( return (
- {hasRecordedAudio ? ( + {hasRecordedAudio ?
diff --git a/packages/@uppy/audio/src/audio-oscilloscope/index.ts b/packages/@uppy/audio/src/audio-oscilloscope/index.ts index fa985517b1..f60b05406c 100644 --- a/packages/@uppy/audio/src/audio-oscilloscope/index.ts +++ b/packages/@uppy/audio/src/audio-oscilloscope/index.ts @@ -75,9 +75,11 @@ export default class AudioOscilloscope { this.canvasContext.strokeStyle = result(canvasContextOptions.strokeStyle) || 'rgb(0, 0, 0)' this.canvasContext.lineWidth = result(canvasContextOptions.lineWidth) || 1 - this.onDrawFrame = isFunction(options.onDrawFrame) - ? options.onDrawFrame - : () => {} // eslint-disable-line @typescript-eslint/no-empty-function + this.onDrawFrame = + isFunction(options.onDrawFrame) ? + options.onDrawFrame + // eslint-disable-next-line @typescript-eslint/no-empty-function + : () => {} } addSource(streamSource: MediaStreamAudioSourceNode): void { diff --git a/packages/@uppy/audio/tsconfig.json b/packages/@uppy/audio/tsconfig.json index 335ddda842..a76c3b714a 100644 --- a/packages/@uppy/audio/tsconfig.json +++ b/packages/@uppy/audio/tsconfig.json @@ -6,16 +6,16 @@ "paths": { "@uppy/utils/lib/*": ["../utils/src/*"], "@uppy/core": ["../core/src/index.js"], - "@uppy/core/lib/*": ["../core/src/*"] - } + "@uppy/core/lib/*": ["../core/src/*"], + }, }, "include": ["./package.json", "./src/**/*.*"], "references": [ { - "path": "../utils/tsconfig.build.json" + "path": "../utils/tsconfig.build.json", }, { - "path": "../core/tsconfig.build.json" - } - ] + "path": "../core/tsconfig.build.json", + }, + ], } diff --git a/packages/@uppy/companion/tsconfig.json b/packages/@uppy/companion/tsconfig.json index ac532cc3d4..ba8d444ffc 100644 --- a/packages/@uppy/companion/tsconfig.json +++ b/packages/@uppy/companion/tsconfig.json @@ -9,7 +9,7 @@ "sourceMap": false, "allowJs": true, "checkJs": true, - "noEmitOnError": true + "noEmitOnError": true, }, - "include": ["src/**/*"] + "include": ["src/**/*"], } diff --git a/packages/@uppy/core/src/Uppy.test.ts b/packages/@uppy/core/src/Uppy.test.ts index 4d097f0263..7b6ab8e85b 100644 --- a/packages/@uppy/core/src/Uppy.test.ts +++ b/packages/@uppy/core/src/Uppy.test.ts @@ -1273,9 +1273,9 @@ describe('src/Core', () => { core .upload() .then((r) => - typeof r!.uploadID === 'string' && r!.uploadID.length === 21 - ? { ...r, uploadID: 'cjd09qwxb000dlql4tp4doz8h' } - : r, + typeof r!.uploadID === 'string' && r!.uploadID.length === 21 ? + { ...r, uploadID: 'cjd09qwxb000dlql4tp4doz8h' } + : r, ), ).resolves.toMatchSnapshot() }) diff --git a/packages/@uppy/core/src/Uppy.ts b/packages/@uppy/core/src/Uppy.ts index 384aa6f6de..dacfbf2952 100644 --- a/packages/@uppy/core/src/Uppy.ts +++ b/packages/@uppy/core/src/Uppy.ts @@ -835,15 +835,14 @@ export class Uppy { // If the actual File object is passed from input[type=file] or drag-drop, // we normalize it to match Uppy file object const file = ( - fileDescriptorOrFile instanceof File - ? { - name: fileDescriptorOrFile.name, - type: fileDescriptorOrFile.type, - size: fileDescriptorOrFile.size, - data: fileDescriptorOrFile, - } - : fileDescriptorOrFile - ) as UppyFile + fileDescriptorOrFile instanceof File ? + { + name: fileDescriptorOrFile.name, + type: fileDescriptorOrFile.type, + size: fileDescriptorOrFile.size, + data: fileDescriptorOrFile, + } + : fileDescriptorOrFile) as UppyFile const fileType = getFileType(file) const fileName = getFileName(fileType, file) @@ -1334,8 +1333,9 @@ export class Uppy { ...fileInState.progress, bytesUploaded: data.bytesUploaded, bytesTotal: data.bytesTotal, - percentage: canHavePercentage - ? Math.round((data.bytesUploaded / data.bytesTotal) * 100) + percentage: + canHavePercentage ? + Math.round((data.bytesUploaded / data.bytesTotal) * 100) : 0, }, }) @@ -1527,11 +1527,11 @@ export class Uppy { progress: { ...currentProgress, postprocess: - this.#postProcessors.size > 0 - ? { - mode: 'indeterminate', - } - : undefined, + this.#postProcessors.size > 0 ? + { + mode: 'indeterminate', + } + : undefined, uploadComplete: true, percentage: 100, bytesUploaded: currentProgress.bytesTotal, diff --git a/packages/@uppy/core/tsconfig.json b/packages/@uppy/core/tsconfig.json index a23d8f86ee..e5d13ad812 100644 --- a/packages/@uppy/core/tsconfig.json +++ b/packages/@uppy/core/tsconfig.json @@ -6,16 +6,16 @@ "paths": { "@uppy/store-default": ["../store-default/src/index.js"], "@uppy/store-default/lib/*": ["../store-default/src/*"], - "@uppy/utils/lib/*": ["../utils/src/*"] - } + "@uppy/utils/lib/*": ["../utils/src/*"], + }, }, "include": ["./package.json", "./src/**/*.*"], "references": [ { - "path": "../store-default/tsconfig.build.json" + "path": "../store-default/tsconfig.build.json", }, { - "path": "../utils/tsconfig.build.json" - } - ] + "path": "../utils/tsconfig.build.json", + }, + ], } diff --git a/packages/@uppy/image-editor/tsconfig.json b/packages/@uppy/image-editor/tsconfig.json index ca20127b29..96370efb37 100644 --- a/packages/@uppy/image-editor/tsconfig.json +++ b/packages/@uppy/image-editor/tsconfig.json @@ -6,16 +6,16 @@ "paths": { "@uppy/utils/lib/*": ["../utils/src/*"], "@uppy/core": ["../core/src/"], - "@uppy/core/lib/*": ["../core/src/*"] - } + "@uppy/core/lib/*": ["../core/src/*"], + }, }, "include": ["./package.json", "./src/**/*.*"], "references": [ { - "path": "../utils/tsconfig.build.json" + "path": "../utils/tsconfig.build.json", }, { - "path": "../core/tsconfig.build.json" - } - ] + "path": "../core/tsconfig.build.json", + }, + ], } diff --git a/packages/@uppy/locales/tsconfig.json b/packages/@uppy/locales/tsconfig.json index f8a97e4278..ce1879aac4 100644 --- a/packages/@uppy/locales/tsconfig.json +++ b/packages/@uppy/locales/tsconfig.json @@ -3,14 +3,14 @@ "compilerOptions": { "emitDeclarationOnly": false, "paths": { - "@uppy/utils/lib/*": ["../utils/src/*"] + "@uppy/utils/lib/*": ["../utils/src/*"], }, - "noEmit": true + "noEmit": true, }, "include": ["./package.json", "./src/**/*.*"], "references": [ { - "path": "../utils/tsconfig.build.json" - } - ] + "path": "../utils/tsconfig.build.json", + }, + ], } diff --git a/packages/@uppy/status-bar/src/Components.tsx b/packages/@uppy/status-bar/src/Components.tsx index 81c845ae8b..5890a36c64 100644 --- a/packages/@uppy/status-bar/src/Components.tsx +++ b/packages/@uppy/status-bar/src/Components.tsx @@ -47,9 +47,9 @@ function UploadBtn( ) const uploadBtnText = - newFiles && isUploadStarted && !recoveredState - ? i18n('uploadXNewFiles', { smart_count: newFiles }) - : i18n('uploadXFiles', { smart_count: newFiles }) + newFiles && isUploadStarted && !recoveredState ? + i18n('uploadXNewFiles', { smart_count: newFiles }) + : i18n('uploadXFiles', { smart_count: newFiles }) return (