Uh oh!
There was an error while loading. Please reload this page.
BridgeJS: Add swift-format-ignore-file to generated Swift sources - #732
Merged
Conversation
krodakforce-pushed
the
kr/swift-format-ignore-generated
branch
from
April 30, 2026 09:53
c2c007e to
26935edComparekateinoigakukun
approved these changes
Apr 30, 2026
krodak
commented
Apr 30, 2026
MemberAuthor
The CI failure ( |
krodakforce-pushed
the
kr/swift-format-ignore-generated
branch
from
April 30, 2026 10:21
26935ed to
1c107adComparekrodak
commented
Apr 30, 2026
MemberAuthor
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds
// swift-format-ignore-fileto the header of all BridgeJS-generated Swift files (BridgeJS.swiftandBridgeJS.Macros.swift), so thatswift format lintskips them automatically.Fixes#708.
Users who run
swift format linton their projects currently get violations on generated files. Since these files are regenerated byswift package bridge-js, manually adding the comment is not viable — it gets overwritten. Configuring swift-format to exclude specific directories is also surprisingly difficult.This is standard practice for Swift code generators (protobuf-swift, grpc-swift, SwiftGen all do the same).
1.
Utilities.swift— added// swift-format-ignore-filetoBridgeJSGeneratedFile.swiftHeader, after the// bridge-js: skipmarker (which must remain on line 1).2.
cli.js— added// swift-format-ignore-fileas the first line of the TS2Swiftpreludetemplate.