Skip to content

Commit 3f68058

Browse files
chore: update prettier to 3.5.1 and enable experimentalOperatorPosition (#12715)
1 parent 7d82526 commit 3f68058

File tree

13 files changed

+74
-72
lines changed

13 files changed

+74
-72
lines changed

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
33
"semi": false,
4-
"trailingComma": "none"
4+
"trailingComma": "none",
5+
"experimentalOperatorPosition": "start"
56
}

.scripts/ci/check-license-header.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const ignore = [
2828

2929
async function checkFile(file) {
3030
if (
31-
extensions.some((e) => file.endsWith(e)) &&
32-
!ignore.some((i) => file.includes(`/${i}/`) || path.basename(file) == i)
31+
extensions.some((e) => file.endsWith(e))
32+
&& !ignore.some((i) => file.includes(`/${i}/`) || path.basename(file) == i)
3333
) {
3434
const fileStream = fs.createReadStream(file)
3535
const rl = readline.createInterface({
@@ -42,11 +42,11 @@ async function checkFile(file) {
4242
for await (let line of rl) {
4343
// ignore empty lines, allow shebang and bundler license
4444
if (
45-
line.length === 0 ||
46-
line.startsWith('#!') ||
47-
line.startsWith('// swift-tools-version:') ||
48-
line === bundlerLicense ||
49-
line === denoLicense
45+
line.length === 0
46+
|| line.startsWith('#!')
47+
|| line.startsWith('// swift-tools-version:')
48+
|| line === bundlerLicense
49+
|| line === denoLicense
5050
) {
5151
continue
5252
}

bench/tests/cpu_intensive/public/index.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
body {
2-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
3-
Arial, sans-serif;
2+
font-family:
3+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
4+
sans-serif;
45
margin: auto;
56
max-width: 38rem;
67
padding: 2rem;

crates/tauri-utils/src/pattern/isolation.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
if (typeof data === 'object' && typeof data.payload === 'object') {
7878
const keys = data.payload ? Object.keys(data.payload) : []
7979
return (
80-
keys.length > 0 &&
81-
keys.every(
80+
keys.length > 0
81+
&& keys.every(
8282
(key) => key === 'nonce' || key === 'payload' || key === 'contentType'
8383
)
8484
)
@@ -94,10 +94,10 @@
9494
*/
9595
function isIsolationPayload(data) {
9696
return (
97-
typeof data === 'object' &&
98-
'callback' in data &&
99-
'error' in data &&
100-
!isIsolationMessage(data)
97+
typeof data === 'object'
98+
&& 'callback' in data
99+
&& 'error' in data
100+
&& !isIsolationMessage(data)
101101
)
102102
}
103103

@@ -139,8 +139,8 @@
139139
function waitUntilReady() {
140140
// consider either a function or an explicitly set null value as the ready signal
141141
if (
142-
typeof window.__TAURI_ISOLATION_HOOK__ === 'function' ||
143-
window.__TAURI_ISOLATION_HOOK__ === null
142+
typeof window.__TAURI_ISOLATION_HOOK__ === 'function'
143+
|| window.__TAURI_ISOLATION_HOOK__ === null
144144
) {
145145
sendMessage('__TAURI_ISOLATION_READY__')
146146
} else {

crates/tauri/scripts/ipc-protocol.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
const { cmd, callback, error, payload, options } = message
2424

2525
if (
26-
!customProtocolIpcFailed &&
27-
(canUseCustomProtocol || cmd === fetchChannelDataCommand)
26+
!customProtocolIpcFailed
27+
&& (canUseCustomProtocol || cmd === fetchChannelDataCommand)
2828
) {
2929
const { contentType, data } = processIpcMessage(payload)
3030
fetch(window.__TAURI_INTERNALS__.convertFileSrc(cmd, 'ipc'), {

crates/tauri/scripts/ipc.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
*/
3434
function isIsolationMessage(event) {
3535
if (
36-
typeof event.data === 'object' &&
37-
typeof event.data.payload === 'object'
36+
typeof event.data === 'object'
37+
&& typeof event.data.payload === 'object'
3838
) {
3939
const keys = Object.keys(event.data.payload || {})
4040
return (
41-
keys.length > 0 &&
42-
keys.every(
41+
keys.length > 0
42+
&& keys.every(
4343
(key) => key === 'contentType' || key === 'nonce' || key === 'payload'
4444
)
4545
)
@@ -55,10 +55,10 @@
5555
*/
5656
function isIsolationPayload(data) {
5757
return (
58-
typeof data === 'object' &&
59-
'callback' in data &&
60-
'error' in data &&
61-
!isIsolationMessage(data)
58+
typeof data === 'object'
59+
&& 'callback' in data
60+
&& 'error' in data
61+
&& !isIsolationMessage(data)
6262
)
6363
}
6464

@@ -99,27 +99,27 @@
9999
const SERIALIZE_TO_IPC_FN = '__TAURI_TO_IPC_KEY__'
100100

101101
if (
102-
typeof data === 'object' &&
103-
data !== null &&
104-
'constructor' in data &&
105-
data.constructor === Array
102+
typeof data === 'object'
103+
&& data !== null
104+
&& 'constructor' in data
105+
&& data.constructor === Array
106106
) {
107107
return data.map((v) => serializeIpcPayload(v))
108108
}
109109

110110
if (
111-
typeof data === 'object' &&
112-
data !== null &&
113-
SERIALIZE_TO_IPC_FN in data
111+
typeof data === 'object'
112+
&& data !== null
113+
&& SERIALIZE_TO_IPC_FN in data
114114
) {
115115
return data[SERIALIZE_TO_IPC_FN]()
116116
}
117117

118118
if (
119-
typeof data === 'object' &&
120-
data !== null &&
121-
'constructor' in data &&
122-
data.constructor === Object
119+
typeof data === 'object'
120+
&& data !== null
121+
&& 'constructor' in data
122+
&& data.constructor === Object
123123
) {
124124
const acc = {}
125125
Object.entries(data).forEach(([k, v]) => {

crates/tauri/src/webview/scripts/toggle-devtools.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
}
2222

2323
if (
24-
document.readyState === 'complete' ||
25-
document.readyState === 'interactive'
24+
document.readyState === 'complete'
25+
|| document.readyState === 'interactive'
2626
) {
2727
toggleDevtoolsHotkey()
2828
} else {

crates/tauri/src/window/scripts/drag.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
document.addEventListener('mousedown', (e) => {
1717
if (
1818
// element has the magic data attribute
19-
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR) &&
19+
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR)
2020
// and was left mouse button
21-
e.button === 0 &&
21+
&& e.button === 0
2222
// and was normal click to drag or double click to maximize
23-
(e.detail === 1 || e.detail === 2)
23+
&& (e.detail === 1 || e.detail === 2)
2424
) {
2525
// macOS maximization happens on `mouseup`,
2626
// so we save needed state and early return
@@ -48,14 +48,14 @@
4848
document.addEventListener('mouseup', (e) => {
4949
if (
5050
// element has the magic data attribute
51-
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR) &&
51+
e.target.hasAttribute(TAURI_DRAG_REGION_ATTR)
5252
// and was left mouse button
53-
e.button === 0 &&
53+
&& e.button === 0
5454
// and was double click
55-
e.detail === 2 &&
55+
&& e.detail === 2
5656
// and the cursor hasn't moved from initial mousedown
57-
e.clientX === x &&
58-
e.clientY === y
57+
&& e.clientX === x
58+
&& e.clientY === y
5959
) {
6060
window.__TAURI_INTERNALS__.invoke(
6161
'plugin:window|internal_toggle_maximize'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"example:api:dev": "pnpm run --filter \"api\" tauri dev"
2424
},
2525
"devDependencies": {
26-
"prettier": "^3.4.2"
26+
"prettier": "^3.5.1"
2727
},
2828
"packageManager": "pnpm@9.9.0",
2929
"pnpm": {

packages/api/src/menu/base.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ export async function newMenu(
6262

6363
// about predefined menu item icon
6464
if (
65-
'item' in opts &&
66-
opts.item &&
67-
typeof opts.item === 'object' &&
68-
'About' in opts.item &&
69-
opts.item.About &&
70-
typeof opts.item.About === 'object' &&
71-
'icon' in opts.item.About &&
72-
opts.item.About.icon
65+
'item' in opts
66+
&& opts.item
67+
&& typeof opts.item === 'object'
68+
&& 'About' in opts.item
69+
&& opts.item.About
70+
&& typeof opts.item.About === 'object'
71+
&& 'icon' in opts.item.About
72+
&& opts.item.About.icon
7373
) {
7474
opts.item.About.icon = transformImage(opts.item.About.icon)
7575
}

0 commit comments

Comments
 (0)