chore: update prettier to 3.5.1 and enable experimentalOperatorPosition (#12715)

This commit is contained in:
Tony
2025-02-16 20:34:19 +08:00
committed by GitHub
parent 7d8252679d
commit 3f680588cd
13 changed files with 74 additions and 72 deletions

View File

@@ -1,5 +1,6 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "none"
"trailingComma": "none",
"experimentalOperatorPosition": "start"
}

View File

@@ -28,8 +28,8 @@ const ignore = [
async function checkFile(file) {
if (
extensions.some((e) => file.endsWith(e)) &&
!ignore.some((i) => file.includes(`/${i}/`) || path.basename(file) == i)
extensions.some((e) => file.endsWith(e))
&& !ignore.some((i) => file.includes(`/${i}/`) || path.basename(file) == i)
) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
@@ -42,11 +42,11 @@ async function checkFile(file) {
for await (let line of rl) {
// ignore empty lines, allow shebang and bundler license
if (
line.length === 0 ||
line.startsWith('#!') ||
line.startsWith('// swift-tools-version:') ||
line === bundlerLicense ||
line === denoLicense
line.length === 0
|| line.startsWith('#!')
|| line.startsWith('// swift-tools-version:')
|| line === bundlerLicense
|| line === denoLicense
) {
continue
}

View File

@@ -1,6 +1,7 @@
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
Arial, sans-serif;
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
sans-serif;
margin: auto;
max-width: 38rem;
padding: 2rem;

View File

@@ -77,8 +77,8 @@
if (typeof data === 'object' && typeof data.payload === 'object') {
const keys = data.payload ? Object.keys(data.payload) : []
return (
keys.length > 0 &&
keys.every(
keys.length > 0
&& keys.every(
(key) => key === 'nonce' || key === 'payload' || key === 'contentType'
)
)
@@ -94,10 +94,10 @@
*/
function isIsolationPayload(data) {
return (
typeof data === 'object' &&
'callback' in data &&
'error' in data &&
!isIsolationMessage(data)
typeof data === 'object'
&& 'callback' in data
&& 'error' in data
&& !isIsolationMessage(data)
)
}
@@ -139,8 +139,8 @@
function waitUntilReady() {
// consider either a function or an explicitly set null value as the ready signal
if (
typeof window.__TAURI_ISOLATION_HOOK__ === 'function' ||
window.__TAURI_ISOLATION_HOOK__ === null
typeof window.__TAURI_ISOLATION_HOOK__ === 'function'
|| window.__TAURI_ISOLATION_HOOK__ === null
) {
sendMessage('__TAURI_ISOLATION_READY__')
} else {

View File

@@ -23,8 +23,8 @@
const { cmd, callback, error, payload, options } = message
if (
!customProtocolIpcFailed &&
(canUseCustomProtocol || cmd === fetchChannelDataCommand)
!customProtocolIpcFailed
&& (canUseCustomProtocol || cmd === fetchChannelDataCommand)
) {
const { contentType, data } = processIpcMessage(payload)
fetch(window.__TAURI_INTERNALS__.convertFileSrc(cmd, 'ipc'), {

View File

@@ -33,13 +33,13 @@
*/
function isIsolationMessage(event) {
if (
typeof event.data === 'object' &&
typeof event.data.payload === 'object'
typeof event.data === 'object'
&& typeof event.data.payload === 'object'
) {
const keys = Object.keys(event.data.payload || {})
return (
keys.length > 0 &&
keys.every(
keys.length > 0
&& keys.every(
(key) => key === 'contentType' || key === 'nonce' || key === 'payload'
)
)
@@ -55,10 +55,10 @@
*/
function isIsolationPayload(data) {
return (
typeof data === 'object' &&
'callback' in data &&
'error' in data &&
!isIsolationMessage(data)
typeof data === 'object'
&& 'callback' in data
&& 'error' in data
&& !isIsolationMessage(data)
)
}
@@ -99,27 +99,27 @@
const SERIALIZE_TO_IPC_FN = '__TAURI_TO_IPC_KEY__'
if (
typeof data === 'object' &&
data !== null &&
'constructor' in data &&
data.constructor === Array
typeof data === 'object'
&& data !== null
&& 'constructor' in data
&& data.constructor === Array
) {
return data.map((v) => serializeIpcPayload(v))
}
if (
typeof data === 'object' &&
data !== null &&
SERIALIZE_TO_IPC_FN in data
typeof data === 'object'
&& data !== null
&& SERIALIZE_TO_IPC_FN in data
) {
return data[SERIALIZE_TO_IPC_FN]()
}
if (
typeof data === 'object' &&
data !== null &&
'constructor' in data &&
data.constructor === Object
typeof data === 'object'
&& data !== null
&& 'constructor' in data
&& data.constructor === Object
) {
const acc = {}
Object.entries(data).forEach(([k, v]) => {

View File

@@ -21,8 +21,8 @@
}
if (
document.readyState === 'complete' ||
document.readyState === 'interactive'
document.readyState === 'complete'
|| document.readyState === 'interactive'
) {
toggleDevtoolsHotkey()
} else {

View File

@@ -16,11 +16,11 @@
document.addEventListener('mousedown', (e) => {
if (
// element has the magic data attribute
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR) &&
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR)
// and was left mouse button
e.button === 0 &&
&& e.button === 0
// and was normal click to drag or double click to maximize
(e.detail === 1 || e.detail === 2)
&& (e.detail === 1 || e.detail === 2)
) {
// macOS maximization happens on `mouseup`,
// so we save needed state and early return
@@ -48,14 +48,14 @@
document.addEventListener('mouseup', (e) => {
if (
// element has the magic data attribute
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR) &&
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR)
// and was left mouse button
e.button === 0 &&
&& e.button === 0
// and was double click
e.detail === 2 &&
&& e.detail === 2
// and the cursor hasn't moved from initial mousedown
e.clientX === x &&
e.clientY === y
&& e.clientX === x
&& e.clientY === y
) {
window.__TAURI_INTERNALS__.invoke(
'plugin:window|internal_toggle_maximize'

View File

@@ -23,7 +23,7 @@
"example:api:dev": "pnpm run --filter \"api\" tauri dev"
},
"devDependencies": {
"prettier": "^3.4.2"
"prettier": "^3.5.1"
},
"packageManager": "pnpm@9.9.0",
"pnpm": {

View File

@@ -62,14 +62,14 @@ export async function newMenu(
// about predefined menu item icon
if (
'item' in opts &&
opts.item &&
typeof opts.item === 'object' &&
'About' in opts.item &&
opts.item.About &&
typeof opts.item.About === 'object' &&
'icon' in opts.item.About &&
opts.item.About.icon
'item' in opts
&& opts.item
&& typeof opts.item === 'object'
&& 'About' in opts.item
&& opts.item.About
&& typeof opts.item.About === 'object'
&& 'icon' in opts.item.About
&& opts.item.About.icon
) {
opts.item.About.icon = transformImage(opts.item.About.icon)
}

View File

@@ -46,8 +46,8 @@ export function itemFromKind([rid, id, kind]: [number, string, ItemKind]):
/* eslint-enable @typescript-eslint/no-unsafe-return */
}
export type SubmenuOptions = Omit<MenuItemOptions, 'accelerator' | 'action'> &
MenuOptions
export type SubmenuOptions = Omit<MenuItemOptions, 'accelerator' | 'action'>
& MenuOptions
/** A type that is a submenu inside a {@linkcode Menu} or {@linkcode Submenu}. */
export class Submenu extends MenuItemBase {

View File

@@ -74,8 +74,8 @@ class WebviewWindow {
*/
constructor(
label: WebviewLabel,
options: Omit<WebviewOptions, 'x' | 'y' | 'width' | 'height'> &
WindowOptions = {}
options: Omit<WebviewOptions, 'x' | 'y' | 'width' | 'height'>
& WindowOptions = {}
) {
this.label = label
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
@@ -240,17 +240,17 @@ function applyMixins(
).forEach((extendedClass: { prototype: unknown }) => {
Object.getOwnPropertyNames(extendedClass.prototype).forEach((name) => {
if (
typeof baseClass.prototype === 'object' &&
baseClass.prototype &&
name in baseClass.prototype
typeof baseClass.prototype === 'object'
&& baseClass.prototype
&& name in baseClass.prototype
)
return
Object.defineProperty(
baseClass.prototype,
name,
// eslint-disable-next-line
Object.getOwnPropertyDescriptor(extendedClass.prototype, name) ??
Object.create(null)
Object.getOwnPropertyDescriptor(extendedClass.prototype, name)
?? Object.create(null)
)
})
})

10
pnpm-lock.yaml generated
View File

@@ -13,8 +13,8 @@ importers:
.:
devDependencies:
prettier:
specifier: ^3.4.2
version: 3.4.2
specifier: ^3.5.1
version: 3.5.1
crates/tauri-schema-worker:
devDependencies:
@@ -1698,8 +1698,8 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
prettier@3.4.2:
resolution: {integrity: sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==}
prettier@3.5.1:
resolution: {integrity: sha512-hPpFQvHwL3Qv5AdRvBFMhnKo4tYxp0ReXiPn2bxkiohEX6mBeBwEpBSQTkD458RaaDKQMYSp4hX4UtfUTA5wDw==}
engines: {node: '>=14'}
hasBin: true
@@ -3592,7 +3592,7 @@ snapshots:
prelude-ls@1.2.1: {}
prettier@3.4.2: {}
prettier@3.5.1: {}
printable-characters@1.0.42: {}