worsier 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Worsier
2
2
 
3
- A focused JavaScript, TypeScript, JSX, and TSX formatter powered by Rust. It formats static imports
4
- and the boundaries around runtime variable declarations while preserving the declarations
5
- themselves.
3
+ A focused JavaScript, TypeScript, JSX, and TSX formatter powered by Rust. It formats static imports,
4
+ trailing commas, and the boundaries around runtime variable declarations while preserving source
5
+ text outside the enabled rules.
6
6
  Node.js 24.0.0 or newer is required.
7
7
  Prebuilt Windows x64 binaries are temporarily unavailable while
8
8
  [npm package publication is restored](https://github.com/Perdolique/worsier/issues/11).
@@ -24,3 +24,13 @@ const output = await format('example.ts', "import{answer,type Value}from'pkg'")
24
24
 
25
25
  Pass an optional third `FormatConfig` argument to override the programmatic defaults. The
26
26
  programmatic API does not discover configuration files.
27
+
28
+ ## Broader alternatives
29
+
30
+ [Prettier](https://prettier.io/docs/) is a mature opinionated formatter that prints the complete
31
+ source, while [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) is a fast,
32
+ Prettier-compatible formatter with broader language and formatting coverage. Both provide selected
33
+ configuration options, including [Prettier](https://prettier.io/docs/options#trailing-commas) and
34
+ [Oxfmt](https://oxc.rs/docs/guide/usage/formatter/config-file-reference#trailingcomma)
35
+ trailing-comma modes. Worsier instead focuses on independently configurable source-rewrite rules
36
+ and preserves text outside the selected rules.
@@ -29,7 +29,8 @@
29
29
  "statementSpacing": {
30
30
  "imports": "separate",
31
31
  "variableDeclarations": "separate"
32
- }
32
+ },
33
+ "trailingCommas": "never"
33
34
  }
34
35
  },
35
36
  "verifyAst": {
@@ -52,6 +53,10 @@
52
53
  "imports": "separate",
53
54
  "variableDeclarations": "separate"
54
55
  }
56
+ },
57
+ "trailingCommas": {
58
+ "$ref": "#/$defs/TrailingCommaMode",
59
+ "default": "never"
55
60
  }
56
61
  },
57
62
  "additionalProperties": false
@@ -77,6 +82,14 @@
77
82
  "compact",
78
83
  "off"
79
84
  ]
85
+ },
86
+ "TrailingCommaMode": {
87
+ "type": "string",
88
+ "enum": [
89
+ "always",
90
+ "never",
91
+ "off"
92
+ ]
80
93
  }
81
94
  }
82
95
  }
package/dist/types.d.ts CHANGED
@@ -8,6 +8,7 @@ export interface FormatConfig {
8
8
  export interface RulesConfig {
9
9
  importLayout?: boolean;
10
10
  statementSpacing?: StatementSpacingConfig;
11
+ trailingCommas?: 'always' | 'never' | 'off';
11
12
  }
12
13
  export interface StatementSpacingConfig {
13
14
  imports?: 'separate' | 'compact' | 'off';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "worsier",
3
- "version": "2.1.0",
4
- "description": "A focused JavaScript and TypeScript import and variable-boundary formatter powered by Rust",
3
+ "version": "2.2.0",
4
+ "description": "A focused JavaScript and TypeScript import, trailing-comma, and statement-boundary formatter powered by Rust",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -48,13 +48,13 @@
48
48
  ]
49
49
  },
50
50
  "optionalDependencies": {
51
- "worsier-darwin-arm64": "2.1.0",
52
- "worsier-win32-arm64-msvc": "2.1.0",
53
- "worsier-linux-arm64-gnu": "2.1.0",
54
- "worsier-linux-arm64-musl": "2.1.0",
55
- "worsier-darwin-x64": "2.1.0",
56
- "worsier-linux-x64-gnu": "2.1.0",
57
- "worsier-linux-x64-musl": "2.1.0"
51
+ "worsier-darwin-arm64": "2.2.0",
52
+ "worsier-win32-arm64-msvc": "2.2.0",
53
+ "worsier-linux-arm64-gnu": "2.2.0",
54
+ "worsier-linux-arm64-musl": "2.2.0",
55
+ "worsier-darwin-x64": "2.2.0",
56
+ "worsier-linux-x64-gnu": "2.2.0",
57
+ "worsier-linux-x64-musl": "2.2.0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "26.2.0",