worsier 2.3.0 → 2.4.1

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,11 +1,9 @@
1
1
  # Worsier
2
2
 
3
3
  A focused JavaScript, TypeScript, JSX, and TSX formatter powered by Rust. It formats static imports,
4
- statement and member semicolons, trailing commas, and the boundaries around runtime variable
5
- declarations while preserving source text outside the enabled rules.
4
+ TypeScript interface layout, statement and member semicolons, trailing commas, and the boundaries
5
+ around runtime variable declarations while preserving source text outside the enabled rules.
6
6
  Node.js 24.0.0 or newer is required.
7
- Prebuilt Windows x64 binaries are temporarily unavailable while
8
- [npm package publication is restored](https://github.com/Perdolique/worsier/issues/11).
9
7
 
10
8
  ```sh
11
9
  pnpm add -D worsier
@@ -16,6 +14,11 @@ pnpm exec worsier --write .
16
14
  The CLI uses its opinionated defaults without a configuration file. An optional `worsier.jsonc`
17
15
  can override them; run `pnpm exec worsier --init` to create the complete typed configuration.
18
16
 
17
+ By default, every nonempty TypeScript interface is expanded with one member per line. Set
18
+ `rules.interfaceLayout` to a member threshold from `0` through `4294967295`, or to `"off"` to
19
+ preserve interface layout. Members on the physical line governed by a preceding `// @ts-ignore`
20
+ or `// @ts-expect-error` stay together so formatting does not change TypeScript diagnostics.
21
+
19
22
  ```js
20
23
  import { format } from 'worsier'
21
24
 
@@ -26,6 +26,7 @@
26
26
  "$ref": "#/$defs/RulesConfig",
27
27
  "default": {
28
28
  "importLayout": true,
29
+ "interfaceLayout": 0,
29
30
  "semicolons": {
30
31
  "classMembers": "asNeeded",
31
32
  "statements": "asNeeded",
@@ -45,6 +46,25 @@
45
46
  },
46
47
  "additionalProperties": false,
47
48
  "$defs": {
49
+ "InterfaceLayoutMode": {
50
+ "type": "string",
51
+ "enum": [
52
+ "off"
53
+ ]
54
+ },
55
+ "InterfaceLayoutRule": {
56
+ "anyOf": [
57
+ {
58
+ "type": "integer",
59
+ "format": "uint32",
60
+ "maximum": 4294967295,
61
+ "minimum": 0
62
+ },
63
+ {
64
+ "$ref": "#/$defs/InterfaceLayoutMode"
65
+ }
66
+ ]
67
+ },
48
68
  "RulesConfig": {
49
69
  "type": "object",
50
70
  "properties": {
@@ -52,6 +72,10 @@
52
72
  "type": "boolean",
53
73
  "default": true
54
74
  },
75
+ "interfaceLayout": {
76
+ "$ref": "#/$defs/InterfaceLayoutRule",
77
+ "default": 0
78
+ },
55
79
  "semicolons": {
56
80
  "$ref": "#/$defs/SemicolonConfig",
57
81
  "default": {
package/dist/binding.js CHANGED
@@ -7,7 +7,8 @@ const platformPackages = {
7
7
  'linux-arm64-musl': 'worsier-linux-arm64-musl',
8
8
  'linux-x64-gnu': 'worsier-linux-x64-gnu',
9
9
  'linux-x64-musl': 'worsier-linux-x64-musl',
10
- 'win32-arm64-msvc': 'worsier-win32-arm64-msvc'
10
+ 'win32-arm64-msvc': 'worsier-win32-arm64-msvc',
11
+ 'win32-x64-msvc': 'worsier-win32-x64-msvc'
11
12
  };
12
13
  let binding;
13
14
  function libc() {
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type InterfaceLayoutMode = 'off';
1
2
  export interface FormatConfig {
2
3
  $schema?: string | null;
3
4
  ignorePatterns?: string[];
@@ -7,6 +8,7 @@ export interface FormatConfig {
7
8
  }
8
9
  export interface RulesConfig {
9
10
  importLayout?: boolean;
11
+ interfaceLayout?: number | InterfaceLayoutMode;
10
12
  semicolons?: SemicolonConfig;
11
13
  statementSpacing?: StatementSpacingConfig;
12
14
  trailingCommas?: 'always' | 'never' | 'off';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "worsier",
3
- "version": "2.3.0",
4
- "description": "A focused JavaScript and TypeScript import, trailing-comma, and statement-boundary formatter powered by Rust",
3
+ "version": "2.4.1",
4
+ "description": "A focused JavaScript and TypeScript import, interface-layout, semicolon, trailing-comma, and statement-boundary formatter powered by Rust",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -43,18 +43,20 @@
43
43
  "aarch64-unknown-linux-gnu",
44
44
  "aarch64-unknown-linux-musl",
45
45
  "x86_64-apple-darwin",
46
+ "x86_64-pc-windows-msvc",
46
47
  "x86_64-unknown-linux-gnu",
47
48
  "x86_64-unknown-linux-musl"
48
49
  ]
49
50
  },
50
51
  "optionalDependencies": {
51
- "worsier-darwin-arm64": "2.3.0",
52
- "worsier-win32-arm64-msvc": "2.3.0",
53
- "worsier-linux-arm64-gnu": "2.3.0",
54
- "worsier-linux-arm64-musl": "2.3.0",
55
- "worsier-darwin-x64": "2.3.0",
56
- "worsier-linux-x64-gnu": "2.3.0",
57
- "worsier-linux-x64-musl": "2.3.0"
52
+ "worsier-darwin-arm64": "2.4.1",
53
+ "worsier-win32-arm64-msvc": "2.4.1",
54
+ "worsier-linux-arm64-gnu": "2.4.1",
55
+ "worsier-linux-arm64-musl": "2.4.1",
56
+ "worsier-darwin-x64": "2.4.1",
57
+ "worsier-win32-x64-msvc": "2.4.1",
58
+ "worsier-linux-x64-gnu": "2.4.1",
59
+ "worsier-linux-x64-musl": "2.4.1"
58
60
  },
59
61
  "devDependencies": {
60
62
  "@types/node": "26.2.0",