Skip to content

Commit

Permalink
chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Aug 14, 2023
1 parent fcf2d75 commit dd66c91
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ const formatted = format(input);
console.log(formatted);
```

with custom options:

```javascript
import init, { format_with_config } from "@wasm-fmt/ruff_fmt";

// ...
const formatted = format_with_config(input, {
indent_style: 4,
line_width: 88,
quote_style: "double",
magic_trailing_comma: "respect",
});
console.log(formatted);
```

For Vite users:

```JavaScript
Expand All @@ -46,3 +61,11 @@ import init, { format } from "@wasm-fmt/ruff_fmt/vite";
```bash
dprint config add wasm-fmt/ruff_fmt
```

# How does it work?

[Ruff] is an extremely fast Python linter, written in Rust.

This package is a WebAssembly build of Ruff formatter, with a JavaScript wrapper.

[Ruff]: https://github.com/astral-sh/ruff
1 change: 1 addition & 0 deletions crates/ruff_fmt/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ crates_dir=$(pwd)

cd ../..
wasm-pack build --target=web --scope=wasm-fmt crates/ruff_fmt
cp README.md crates/ruff_fmt/pkg/

cd $crates_dir
# backup ruff_fmt.js
Expand Down

0 comments on commit dd66c91

Please sign in to comment.