Skip to content

Commit e998eac

Browse files
committed
feat: use swift-format-plugin
1 parent de87700 commit e998eac

4 files changed

Lines changed: 19 additions & 128 deletions

File tree

.swift-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lineBreakBeforeControlFlowKeywords": false,
1212
"lineBreakBeforeEachArgument": false,
1313
"lineBreakBeforeEachGenericRequirement": false,
14-
"lineLength": 80,
14+
"lineLength": 120,
1515
"maximumBlankLines": 1,
1616
"multiElementCollectionTrailingCommas": true,
1717
"noAssignmentInExpressions": {
@@ -68,4 +68,4 @@
6868
"spacesAroundRangeFormationOperators": false,
6969
"tabWidth": 2,
7070
"version": 1
71-
}
71+
}

Package.swift

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,6 @@
33

44
import PackageDescription
55

6-
#if os(Windows)
7-
let plugins: [Target.PluginUsage]? = nil
8-
#else
9-
let plugins: [Target.PluginUsage]? = [.plugin(name: "SwiftFormatPlugin")]
10-
#endif
11-
12-
let target: Target = .target(
13-
name: "ANSI",
14-
dependencies: [
15-
.product(name: "ASCII", package: "ASCII"),
16-
.product(name: "Algorithms", package: "swift-algorithms"),
17-
],
18-
plugins: plugins
19-
)
20-
21-
let testTarget: Target = .testTarget(
22-
name: "ANSITests",
23-
dependencies: ["ANSI"]
24-
)
25-
26-
#if os(Windows)
27-
let targets: [Target] = [target, testTarget]
28-
#else
29-
let targets: [Target] = [
30-
target,
31-
testTarget,
32-
.plugin(
33-
name: "SwiftFormatPlugin",
34-
capability: .buildTool(),
35-
path: "Plugins/SwiftFormatPlugin",
36-
packageAccess: true
37-
),
38-
]
39-
#endif
40-
416
let package = Package(
427
name: "ANSI",
438
platforms: [.macOS(.v12)],
@@ -47,6 +12,22 @@ let package = Package(
4712
dependencies: [
4813
.package(url: "https://github.com/besya/ascii.git", from: "1.1.0"),
4914
.package(url: "https://github.com/apple/swift-algorithms", from: "1.2.0"),
15+
.package(url: "https://github.com/besya/swift-format-plugin.git", from: "0.0.5"),
5016
],
51-
targets: targets
17+
targets: [
18+
.target(
19+
name: "ANSI",
20+
dependencies: [
21+
.product(name: "ASCII", package: "ASCII"),
22+
.product(name: "Algorithms", package: "swift-algorithms"),
23+
],
24+
plugins: [
25+
.plugin(name: "LintOnBuild", package: "swift-format-plugin")
26+
]
27+
),
28+
.testTarget(
29+
name: "ANSITests",
30+
dependencies: ["ANSI"]
31+
),
32+
]
5233
)

Plugins/SwiftFormatPlugin/SwiftFormatPlugin.swift

Lines changed: 0 additions & 64 deletions
This file was deleted.

Plugins/SwiftFormatPlugin/swift-format-lint-script.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)