Skip to content

Commit 75634ba

Browse files
Make sure swift-format bundled in 6.0.3 works
1 parent dcec70a commit 75634ba

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

Diff for: .swift-format

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@
66
},
77
"lineBreakBeforeEachArgument": true,
88
"indentConditionalCompilationBlocks": false,
9-
"prioritizeKeepingFunctionOutputTogether": true
9+
"prioritizeKeepingFunctionOutputTogether": true,
10+
"rules": {
11+
"AlwaysUseLowerCamelCase": false
12+
}
1013
}

Diff for: Sources/JavaScriptEventLoop/JSSending.swift

+2
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ public struct JSSendingError: Error, CustomStringConvertible {
367367
/// - Parameters:
368368
/// - object: The `JSObject` to be received.
369369
/// - contextPtr: A pointer to the `_JSSendingContext` instance.
370+
// swift-format-ignore
370371
#if compiler(>=6.1) // @_expose and @_extern are only available in Swift 6.1+
371372
@_expose(wasm, "swjs_receive_response")
372373
@_cdecl("swjs_receive_response")
@@ -386,6 +387,7 @@ func _swjs_receive_response(_ object: JavaScriptObjectRef, _ contextPtr: UnsafeR
386387
/// - Parameters:
387388
/// - error: The error to be received.
388389
/// - contextPtr: A pointer to the `_JSSendingContext` instance.
390+
// swift-format-ignore
389391
#if compiler(>=6.1) // @_expose and @_extern are only available in Swift 6.1+
390392
@_expose(wasm, "swjs_receive_error")
391393
@_cdecl("swjs_receive_error")

Diff for: Tests/JavaScriptEventLoopTests/WebWorkerTaskExecutorTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ final class WebWorkerTaskExecutorTests: XCTestCase {
344344
}
345345
let byteLength1 = try await task1.value
346346
XCTAssertEqual(byteLength1, 100)
347-
347+
348348
let task2 = Task<String?, Never>(executorPreference: executor) {
349349
do {
350350
_ = try await transferring.receive()
@@ -447,7 +447,7 @@ final class WebWorkerTaskExecutorTests: XCTestCase {
447447
/*
448448
func testDeinitJSObjectOnDifferentThread() async throws {
449449
let executor = try await WebWorkerTaskExecutor(numberOfThreads: 1)
450-
450+
451451
var object: JSObject? = JSObject.global.Object.function!.new()
452452
let task = Task(executorPreference: executor) {
453453
object = nil

Diff for: Utilities/format.swift

+11-2
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,14 @@ func filesToFormat() -> [String] {
7676
return files
7777
}
7878

79-
// Format the files in the project.
80-
try swiftFormat(["format", "--parallel", "--in-place", "--recursive"] + filesToFormat())
79+
let arguments = CommandLine.arguments[1...]
80+
switch arguments.first {
81+
case "lint":
82+
try swiftFormat(["lint", "--parallel", "--recursive"] + filesToFormat())
83+
case "format", nil:
84+
try swiftFormat(["format", "--parallel", "--in-place", "--recursive"] + filesToFormat())
85+
case let subcommand?:
86+
print("Unknown subcommand: \(subcommand)")
87+
print("Usage: format.swift lint|format")
88+
exit(1)
89+
}

0 commit comments

Comments
 (0)