Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/prettier/plugin-swift

[DEPRECATED] Prettier Swift Plugin - WARNING: The AST parser is not stable yet
https://github.com/prettier/plugin-swift

prettier swift

Last synced: about 1 month ago
JSON representation

[DEPRECATED] Prettier Swift Plugin - WARNING: The AST parser is not stable yet

Awesome Lists containing this project

README

        

# DEPRECATED

`prettier/plugin-swift` is deprecated. It hasn’t been updated since early 2018, and the Swift community seems to have moved towards [Apple’s swift-format](https://github.com/apple/swift-format) and [Nick Lockwood’s SwiftFormat](https://github.com/nicklockwood/SwiftFormat) instead.

We hope to someday have plugins for one or both of these tools, but the Prettier team has no current plans to develop such an integration. If you do make something, let us know by opening an issue on [the main Prettier repository](https://github.com/prettier/prettier/issues/new), and we will consider adding a link to this README.

- - -


Prettier
Swift

Swift Plugin for the Opinionated Code Formatter



Gitter


Travis


npm version



code style: prettier


Follow+Prettier+on+Twitter

## What does it do?

**:warning: Warning :warning:** This plugin might eat your homework in its early stage.
It also depends on [Swift's lib/Syntax](https://github.com/apple/swift/blob/master/lib/Syntax) which is
[in flux](https://github.com/apple/swift/blob/master/lib/Syntax/Status.md).
Please stage or commit your code before performing any in-place formatting.

You can check out [how it formatted Artsy's Eidolon](https://github.com/sirlantis/eidolon/pull/1/files).

## Prerequisites

You need one of the following:

1. A [snapshot from March 30, 2018 or later](https://swift.org/download/#snapshots),
2. a recent manual build from Swift's [`master`](https://github.com/apple/swift), or
3. Swift 4.2 (once it's available as a beta or released completely).

Assuming you picked **(1)** please follow the
[installation instructions](https://swift.org/download/#using-downloads),
which recommend updating your `PATH` at the end:

```
TOOLCHAIN=swift-DEVELOPMENT-SNAPSHOT-2018-03-30-a.xctoolchain
export PATH=/Library/Developer/Toolchains/${TOOLCHAIN}/usr/bin/:"${PATH}"
```

Alternatively you can pass the full path to the `swiftc` binary
via the environment variable `PRETTIER_SWIFT_SWIFTC`:

```
TOOLCHAIN=swift-DEVELOPMENT-SNAPSHOT-2018-03-30-a.xctoolchain
export PRETTIER_SWIFT_SWIFTC=/Library/Developer/Toolchains/${TOOLCHAIN}/usr/bin/swiftc
```

## Contributing

If you're interested in contributing to the development of Prettier for Swift, you can follow the [CONTRIBUTING guide from Prettier](https://github.com/prettier/prettier/blob/master/CONTRIBUTING.md), as it all applies to this repository too.

To test it out on a Swift file:

* Clone this repository.
* Run `yarn`.
* Create a file called `test.swift`.
* Run `yarn prettier test.swift` to check the output.

## Install

```bash
yarn add --dev --exact prettier prettier/plugin-swift
```

## Use

```bash
prettier --write "**/*.swift"
```

## Maintainers







Marcel Jackwerth