meta: prettier 3.0.3 -> 3.2.4 (#4889)

Notable change: https://prettier.io/blog/2023/11/13/curious-ternaries
This commit is contained in:
Antoine du Hamel 2024-01-24 11:37:01 +01:00 committed by GitHub
parent d18bb0c468
commit 588bfb515e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 174 additions and 166 deletions

View file

@ -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,
},
},
}

View file

@ -4,7 +4,7 @@
"noEmit": true,
"target": "es2020",
"lib": ["es2020", "dom"],
"types": ["cypress"]
"types": ["cypress"],
},
"include": ["cypress/**/*.ts"]
"include": ["cypress/**/*.ts"],
}

View file

@ -717,8 +717,8 @@
<!-- Terminal -->
<div class="terminal" [ngSwitch]="selection.value">
<pre *ngSwitchDefault>ng generate component xyz</pre>
<pre *ngSwitchCase="'material'">ng add @angular/material</pre>
<pre *ngSwitchCase="'pwa'">ng add @angular/pwa</pre>
<pre *ngSwitchCase="'material'">ng add &#64;angular/material</pre>
<pre *ngSwitchCase="'pwa'">ng add &#64;angular/pwa</pre>
<pre *ngSwitchCase="'dependency'">ng add _____</pre>
<pre *ngSwitchCase="'test'">ng test</pre>
<pre *ngSwitchCase="'build'">ng build</pre>

View file

@ -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,
},
}

View file

@ -3,5 +3,5 @@
"compilerOptions": {},
"esModuleInterop": true,
"include": ["src/**/*"],
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
"exclude": ["node_modules/*", "__sapper__/*", "public/*"],
}

View file

@ -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",

View file

@ -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,
},
}

View file

@ -16,9 +16,9 @@ export default (props: PermissionsScreenProps): JSX.Element => {
{hasAudio ? i18n('allowAudioAccessTitle') : i18n('noAudioTitle')}
</h1>
<p>
{hasAudio
? i18n('allowAudioAccessDescription')
: i18n('noAudioDescription')}
{hasAudio ?
i18n('allowAudioAccessDescription')
: i18n('noAudioDescription')}
</p>
</div>
)

View file

@ -91,11 +91,9 @@ export default function RecordingScreen(
return (
<div className="uppy-Audio-container">
<div className="uppy-Audio-audioContainer">
{hasRecordedAudio ? (
{hasRecordedAudio ?
<audio className="uppy-Audio-player" controls src={recordedAudio} />
) : (
<canvas ref={canvasEl} className="uppy-Audio-canvas" />
)}
: <canvas ref={canvasEl} className="uppy-Audio-canvas" />}
</div>
<div className="uppy-Audio-footer">
<div className="uppy-Audio-audioSourceContainer">

View file

@ -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 {

View file

@ -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",
},
],
}

View file

@ -9,7 +9,7 @@
"sourceMap": false,
"allowJs": true,
"checkJs": true,
"noEmitOnError": true
"noEmitOnError": true,
},
"include": ["src/**/*"]
"include": ["src/**/*"],
}

View file

@ -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()
})

View file

@ -835,15 +835,14 @@ export class Uppy<M extends Meta, B extends Body> {
// 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<M, B>
fileDescriptorOrFile instanceof File ?
{
name: fileDescriptorOrFile.name,
type: fileDescriptorOrFile.type,
size: fileDescriptorOrFile.size,
data: fileDescriptorOrFile,
}
: fileDescriptorOrFile) as UppyFile<M, B>
const fileType = getFileType(file)
const fileName = getFileName(fileType, file)
@ -1334,8 +1333,9 @@ export class Uppy<M extends Meta, B extends Body> {
...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<M extends Meta, B extends Body> {
progress: {
...currentProgress,
postprocess:
this.#postProcessors.size > 0
? {
mode: 'indeterminate',
}
: undefined,
this.#postProcessors.size > 0 ?
{
mode: 'indeterminate',
}
: undefined,
uploadComplete: true,
percentage: 100,
bytesUploaded: currentProgress.bytesTotal,

View file

@ -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",
},
],
}

View file

@ -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",
},
],
}

View file

@ -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",
},
],
}

View file

@ -47,9 +47,9 @@ function UploadBtn<M extends Meta, B extends Body>(
)
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 (
<button
@ -196,9 +196,9 @@ function PauseResumeButton<M extends Meta, B extends Body>(
<path
fill="#FFF"
d={
isAllPaused
? 'M6 4.25L11.5 8 6 11.75z'
: 'M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z'
isAllPaused ?
'M6 4.25L11.5 8 6 11.75z'
: 'M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z'
}
/>
</g>
@ -427,7 +427,9 @@ function ProgressBarUploading(
return (
<div className="uppy-StatusBar-content" aria-label={title} title={title}>
{!isAllPaused ? <LoadingSpinner /> : null}
{!isAllPaused ?
<LoadingSpinner />
: null}
<div className="uppy-StatusBar-status">
<div className="uppy-StatusBar-statusPrimary">
{supportsUploadProgress ? `${title}: ${totalProgress}%` : title}
@ -435,13 +437,13 @@ function ProgressBarUploading(
{renderProgressDetails()}
{showUploadNewlyAddedFiles ? (
{showUploadNewlyAddedFiles ?
<UploadNewlyAddedFiles
i18n={i18n}
newFiles={newFiles}
startUpload={startUpload}
/>
) : null}
: null}
</div>
</div>
)

View file

@ -128,17 +128,17 @@ export default class StatusBar<M extends Meta, B extends Body> extends UIPlugin<
}
const currentSpeed = uploadedBytesSinceLastTick / dt
const filteredSpeed =
this.#previousSpeed == null
? currentSpeed
: emaFilter(currentSpeed, this.#previousSpeed, speedFilterHalfLife, dt)
this.#previousSpeed == null ?
currentSpeed
: emaFilter(currentSpeed, this.#previousSpeed, speedFilterHalfLife, dt)
this.#previousSpeed = filteredSpeed
const instantETA = totalBytes.remaining / filteredSpeed
const updatedPreviousETA = Math.max(this.#previousETA! - dt, 0)
const filteredETA =
this.#previousETA == null
? instantETA
: emaFilter(instantETA, updatedPreviousETA, ETAFilterHalfLife, dt)
this.#previousETA == null ?
instantETA
: emaFilter(instantETA, updatedPreviousETA, ETAFilterHalfLife, dt)
this.#previousETA = filteredETA
this.#lastUpdateTime = performance.now()

View file

@ -249,7 +249,7 @@ export default function StatusBar<M extends Meta, B extends Body>(
})()}
<div className="uppy-StatusBar-actions">
{recoveredState || showUploadBtn ? (
{recoveredState || showUploadBtn ?
<UploadBtn
newFiles={newFiles}
isUploadStarted={isUploadStarted}
@ -259,11 +259,13 @@ export default function StatusBar<M extends Meta, B extends Body>(
startUpload={startUpload}
uploadState={uploadState}
/>
) : null}
: null}
{showRetryBtn ? <RetryBtn i18n={i18n} uppy={uppy} /> : null}
{showRetryBtn ?
<RetryBtn i18n={i18n} uppy={uppy} />
: null}
{showPauseResumeBtn ? (
{showPauseResumeBtn ?
<PauseResumeButton
isAllPaused={isAllPaused}
i18n={i18n}
@ -271,13 +273,15 @@ export default function StatusBar<M extends Meta, B extends Body>(
resumableUploads={resumableUploads}
uppy={uppy}
/>
) : null}
: null}
{showCancelBtn ? <CancelBtn i18n={i18n} uppy={uppy} /> : null}
{showCancelBtn ?
<CancelBtn i18n={i18n} uppy={uppy} />
: null}
{showDoneBtn ? (
{showDoneBtn ?
<DoneBtn i18n={i18n} doneButtonHandler={doneButtonHandler} />
) : null}
: null}
</div>
</div>
)

View file

@ -5,17 +5,17 @@
"paths": {
"@uppy/core": ["../core/src/index.js"],
"@uppy/core/lib/*": ["../core/src/*"],
"@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",
},
{
"path": "../core/tsconfig.build.json"
}
]
"path": "../core/tsconfig.build.json",
},
],
}

View file

@ -2,8 +2,8 @@
"extends": "../../../tsconfig.shared",
"compilerOptions": {
"emitDeclarationOnly": false,
"noEmit": true
"noEmit": true,
},
"include": ["./package.json", "./src/**/*.*"],
"references": []
"references": [],
}

View file

@ -2,8 +2,8 @@
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"esModuleInterop": true,
"sourceMap": true
"sourceMap": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules/*"]
"exclude": ["node_modules/*"],
}

View file

@ -3,7 +3,9 @@ import isDOMElement from './isDOMElement.ts'
export default function findDOMElement<T>(
element: T,
context: Document = document,
): T extends Element ? T : T extends Node | string ? Element | null : null {
): T extends Element ? T
: T extends Node | string ? Element | null
: null {
if (typeof element === 'string') {
// @ts-expect-error ????
return context.querySelector(element)

View file

@ -21,11 +21,10 @@ function getAsFileSystemHandleFromEntry(
): FileSystemFileHandle | FileSystemDirectoryHandle | null | undefined {
if (entry == null) return entry
return {
// eslint-disable-next-line no-nested-ternary
kind: entry.isFile
? 'file'
: entry.isDirectory
? 'directory'
kind:
// eslint-disable-next-line no-nested-ternary
entry.isFile ? 'file'
: entry.isDirectory ? 'directory'
: (undefined as never),
name: entry.name,
getFile(): ReturnType<FileSystemFileHandle['getFile']> {
@ -114,9 +113,9 @@ export default async function* getFilesFromDataTransfer(
const getAsEntry = (): ReturnType<
DataTransferItem['webkitGetAsEntry']
> =>
typeof (item as any).getAsEntry === 'function'
? (item as any).getAsEntry()
: item.webkitGetAsEntry()
typeof (item as any).getAsEntry === 'function' ?
(item as any).getAsEntry()
: item.webkitGetAsEntry()
// eslint-disable-next-line prefer-const
fileSystemHandle ??= getAsFileSystemHandleFromEntry(
getAsEntry(),

View file

@ -5,8 +5,9 @@ import mimeTypes from './mimeTypes.ts'
export default function getFileType(file: Partial<UppyFile<any, any>>): string {
if (file.type) return file.type
const fileExtension = file.name
? getFileNameAndExtension(file.name).extension?.toLowerCase()
const fileExtension =
file.name ?
getFileNameAndExtension(file.name).extension?.toLowerCase()
: null
if (fileExtension && fileExtension in mimeTypes) {
// else, see if we can map extension to a mime type

View file

@ -8,21 +8,21 @@ export default function prettyETA(seconds: number): string {
// Display a leading zero if the there is a preceding unit: 1m 05s, but 5s
const hoursStr = time.hours === 0 ? '' : `${time.hours}h`
const minutesStr =
time.minutes === 0
? ''
: `${
time.hours === 0
? time.minutes
: ` ${time.minutes.toString(10).padStart(2, '0')}`
}m`
time.minutes === 0 ?
''
: `${
time.hours === 0 ?
time.minutes
: ` ${time.minutes.toString(10).padStart(2, '0')}`
}m`
const secondsStr =
time.hours !== 0
? ''
: `${
time.minutes === 0
? time.seconds
: ` ${time.seconds.toString(10).padStart(2, '0')}`
}s`
time.hours !== 0 ?
''
: `${
time.minutes === 0 ?
time.seconds
: ` ${time.seconds.toString(10).padStart(2, '0')}`
}s`
return `${hoursStr}${minutesStr}${secondsStr}`
}

View file

@ -3,8 +3,8 @@
"compilerOptions": {
"allowJs": true,
"emitDeclarationOnly": false,
"noEmit": true
"noEmit": true,
},
"include": ["src/*.ts"],
"references": []
"references": [],
}

View file

@ -4,7 +4,7 @@
"allowJs": true,
"emitDeclarationOnly": false,
"skipLibCheck": true,
"noEmit": true
"noEmit": true,
},
"include": ["types/*"]
"include": ["types/*"],
}

View file

@ -84,9 +84,9 @@ for await (const dirent of dir) {
const ext = extname(name)
if (ext !== '.js' && ext !== '.jsx') continue // eslint-disable-line no-continue
const filePath =
basename(dirent.path) === name
? dirent.path // Some versions of Node.js give the full path as dirent.path.
: join(dirent.path, name) // Others supply only the path to the parent.
basename(dirent.path) === name ?
dirent.path // Some versions of Node.js give the full path as dirent.path.
: join(dirent.path, name) // Others supply only the path to the parent.
await writeFile(
`${filePath.slice(0, -ext.length)}${ext.replace('js', 'ts')}`,
(await readFile(filePath, 'utf-8'))

View file

@ -25774,11 +25774,11 @@ __metadata:
linkType: hard
"prettier@npm:^3.0.3":
version: 3.0.3
resolution: "prettier@npm:3.0.3"
version: 3.2.4
resolution: "prettier@npm:3.2.4"
bin:
prettier: bin/prettier.cjs
checksum: e10b9af02b281f6c617362ebd2571b1d7fc9fb8a3bd17e371754428cda992e5e8d8b7a046e8f7d3e2da1dcd21aa001e2e3c797402ebb6111b5cd19609dd228e0
checksum: 6ec9385a836e0b9bac549e585101c086d1521c31d7b882d5c8bb7d7646da0693da5f31f4fff6dc080710e5e2d34c85e6fb2f8766876b3645c8be2f33b9c3d1a3
languageName: node
linkType: hard