worsier 2.3.0 → 2.5.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 +8 -4
- package/configuration_schema.json +30 -0
- package/dist/binding.js +2 -1
- package/dist/types.d.ts +3 -0
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
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
|
|
5
|
-
declarations while preserving source text
|
|
4
|
+
TypeScript interface layout, statement and member semicolons, trailing commas, and the boundaries
|
|
5
|
+
around TypeScript type aliases and runtime variable declarations while preserving source text
|
|
6
|
+
outside the enabled rules.
|
|
6
7
|
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
8
|
|
|
10
9
|
```sh
|
|
11
10
|
pnpm add -D worsier
|
|
@@ -16,6 +15,11 @@ pnpm exec worsier --write .
|
|
|
16
15
|
The CLI uses its opinionated defaults without a configuration file. An optional `worsier.jsonc`
|
|
17
16
|
can override them; run `pnpm exec worsier --init` to create the complete typed configuration.
|
|
18
17
|
|
|
18
|
+
By default, every nonempty TypeScript interface is expanded with one member per line. Set
|
|
19
|
+
`rules.interfaceLayout` to a member threshold from `0` through `4294967295`, or to `"off"` to
|
|
20
|
+
preserve interface layout. Members on the physical line governed by a preceding `// @ts-ignore`
|
|
21
|
+
or `// @ts-expect-error` stay together so formatting does not change TypeScript diagnostics.
|
|
22
|
+
|
|
19
23
|
```js
|
|
20
24
|
import { format } from 'worsier'
|
|
21
25
|
|
|
@@ -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",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"statementSpacing": {
|
|
35
36
|
"imports": "separate",
|
|
37
|
+
"typeAliases": "separate",
|
|
36
38
|
"variableDeclarations": "separate"
|
|
37
39
|
},
|
|
38
40
|
"trailingCommas": "never"
|
|
@@ -45,6 +47,25 @@
|
|
|
45
47
|
},
|
|
46
48
|
"additionalProperties": false,
|
|
47
49
|
"$defs": {
|
|
50
|
+
"InterfaceLayoutMode": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"enum": [
|
|
53
|
+
"off"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"InterfaceLayoutRule": {
|
|
57
|
+
"anyOf": [
|
|
58
|
+
{
|
|
59
|
+
"type": "integer",
|
|
60
|
+
"format": "uint32",
|
|
61
|
+
"maximum": 4294967295,
|
|
62
|
+
"minimum": 0
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"$ref": "#/$defs/InterfaceLayoutMode"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
48
69
|
"RulesConfig": {
|
|
49
70
|
"type": "object",
|
|
50
71
|
"properties": {
|
|
@@ -52,6 +73,10 @@
|
|
|
52
73
|
"type": "boolean",
|
|
53
74
|
"default": true
|
|
54
75
|
},
|
|
76
|
+
"interfaceLayout": {
|
|
77
|
+
"$ref": "#/$defs/InterfaceLayoutRule",
|
|
78
|
+
"default": 0
|
|
79
|
+
},
|
|
55
80
|
"semicolons": {
|
|
56
81
|
"$ref": "#/$defs/SemicolonConfig",
|
|
57
82
|
"default": {
|
|
@@ -64,6 +89,7 @@
|
|
|
64
89
|
"$ref": "#/$defs/StatementSpacingConfig",
|
|
65
90
|
"default": {
|
|
66
91
|
"imports": "separate",
|
|
92
|
+
"typeAliases": "separate",
|
|
67
93
|
"variableDeclarations": "separate"
|
|
68
94
|
}
|
|
69
95
|
},
|
|
@@ -107,6 +133,10 @@
|
|
|
107
133
|
"$ref": "#/$defs/StatementSpacingMode",
|
|
108
134
|
"default": "separate"
|
|
109
135
|
},
|
|
136
|
+
"typeAliases": {
|
|
137
|
+
"$ref": "#/$defs/StatementSpacingMode",
|
|
138
|
+
"default": "separate"
|
|
139
|
+
},
|
|
110
140
|
"variableDeclarations": {
|
|
111
141
|
"$ref": "#/$defs/StatementSpacingMode",
|
|
112
142
|
"default": "separate"
|
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';
|
|
@@ -18,5 +20,6 @@ export interface SemicolonConfig {
|
|
|
18
20
|
}
|
|
19
21
|
export interface StatementSpacingConfig {
|
|
20
22
|
imports?: 'separate' | 'compact' | 'off';
|
|
23
|
+
typeAliases?: 'separate' | 'compact' | 'off';
|
|
21
24
|
variableDeclarations?: 'separate' | 'compact' | 'off';
|
|
22
25
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worsier",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "A focused JavaScript and TypeScript import, trailing-comma, and statement-boundary formatter powered by Rust",
|
|
3
|
+
"version": "2.5.0",
|
|
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.
|
|
52
|
-
"worsier-win32-arm64-msvc": "2.
|
|
53
|
-
"worsier-linux-arm64-gnu": "2.
|
|
54
|
-
"worsier-linux-arm64-musl": "2.
|
|
55
|
-
"worsier-darwin-x64": "2.
|
|
56
|
-
"worsier-
|
|
57
|
-
"worsier-linux-x64-
|
|
52
|
+
"worsier-darwin-arm64": "2.5.0",
|
|
53
|
+
"worsier-win32-arm64-msvc": "2.5.0",
|
|
54
|
+
"worsier-linux-arm64-gnu": "2.5.0",
|
|
55
|
+
"worsier-linux-arm64-musl": "2.5.0",
|
|
56
|
+
"worsier-darwin-x64": "2.5.0",
|
|
57
|
+
"worsier-win32-x64-msvc": "2.5.0",
|
|
58
|
+
"worsier-linux-x64-gnu": "2.5.0",
|
|
59
|
+
"worsier-linux-x64-musl": "2.5.0"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
62
|
"@types/node": "26.2.0",
|