0.9.7 • Published 4 months ago
@wasm-fmt/ruff_fmt v0.9.7
Install
npm install @wasm-fmt/ruff_fmt
npx jsr add @fmt/ruff-fmt
Usage
import init, { format } from "@wasm-fmt/ruff_fmt";
await init();
const input = `x = { 'a':37,'b':42,
'c':927}
y = 'hello ''world'
z = 'hello '+'world'
a = 'hello {}'.format('world')
class foo ( object ):
def f (self ):
return 37*-+2
def g(self, x,y=42):
return y
def f ( a ) :
return 37+-+a[42-x : y**3]`;
const formatted = format(input);
console.log(formatted);
with custom options:
import init, { format } from "@wasm-fmt/ruff_fmt";
// ...
const formatted = format(input, {
indent_style: "space",
indent_width: 4,
line_width: 88,
quote_style: "double",
magic_trailing_comma: "respect",
});
console.log(formatted);
For Vite users:
Add "@wasm-fmt/ruff_fmt"
to optimizeDeps.exclude
in your vite config:
{
"optimizeDeps": {
"exclude": ["@wasm-fmt/ruff_fmt"]
}
}
import init, { format } from "@wasm-fmt/ruff_fmt/vite";
// ...
dprint plugin
!NOTE dpint plugin is deprecated, please use https://dprint.dev/plugins/ruff instead.
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.
0.9.7
4 months ago
0.9.4
5 months ago
0.9.2
5 months ago
0.9.1
5 months ago
0.8.6
6 months ago
0.9.0
6 months ago
0.8.3
6 months ago
0.8.1
7 months ago
0.7.4
7 months ago
0.7.1
8 months ago
0.7.0
8 months ago
0.6.1
10 months ago
0.5.10
1 year ago
0.5.9
1 year ago
0.5.8
1 year ago
0.5.7
1 year ago
0.5.6
1 year ago
0.5.5
1 year ago
0.5.4
1 year ago
0.5.3
1 year ago
0.5.2
1 year ago
0.5.1
1 year ago
0.5.0
2 years ago
0.4.3
2 years ago
0.4.2
2 years ago
0.4.1
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.1.0
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.1
2 years ago