resultar 3.0.0-alpha.2 → 3.0.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.
Files changed (2) hide show
  1. package/README.md +29 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -22,8 +22,8 @@ Use it when expected failures should be impossible to miss:
22
22
  code.
23
23
  - Ignored `Result` values can be reported by a type-aware no-discard check.
24
24
 
25
- Resultar began as an initial fork of `neverthrow`. The v3 alpha line keeps the explicit wrapper
26
- model, then leans into Resultar-specific tagged errors, strict service-boundary types, TypeScript 6
25
+ Resultar began as an initial fork of `neverthrow`. The v3 line keeps the explicit wrapper model,
26
+ then leans into Resultar-specific tagged errors, strict service-boundary types, TypeScript 6
27
27
  support, and ESM-only packaging.
28
28
 
29
29
  ## Install
@@ -97,7 +97,7 @@ in normal TypeScript.
97
97
  | Production errors need stable names and metadata | `createTaggedError` classes with `_tag`, template props, `cause`, and `.toJSON()` |
98
98
  | Async flows turn into nested `try/catch` | `tryResultAsync`, `andThen`, `asyncAndThen`, `map`, `orElse`, `safeTry` |
99
99
  | Boundary handlers miss cases | `matchTags` for exhaustive tagged-error handling |
100
- | Results are easy to ignore | `resultar-no-discard` and the `resultar-ls` TypeScript plugin |
100
+ | Results are easy to ignore | `resultar-lint check` and the `resultar-lint` TypeScript plugin |
101
101
  | You do not want another application runtime | A small ESM library around explicit values |
102
102
 
103
103
  Nested `try/catch` often masks the error the caller actually needs:
@@ -562,11 +562,11 @@ const config = safeTry({
562
562
 
563
563
  ## No-Discard Validation
564
564
 
565
- Resultar values should not be ignored. Install `resultar-ls` to report discarded `Result` and
565
+ Resultar values should not be ignored. Install `resultar-lint` to report discarded `Result` and
566
566
  `ResultAsync` values.
567
567
 
568
568
  ```sh
569
- pnpm add -D resultar-ls typescript
569
+ pnpm add -D resultar-lint typescript
570
570
  ```
571
571
 
572
572
  Add a lint-like script:
@@ -574,31 +574,36 @@ Add a lint-like script:
574
574
  ```json
575
575
  {
576
576
  "scripts": {
577
- "lint:resultar": "resultar-no-discard --project tsconfig.json"
577
+ "lint:resultar": "resultar-lint check --project tsconfig.json"
578
578
  }
579
579
  }
580
580
  ```
581
581
 
582
- This fails:
582
+ These fail in the default `must-use` mode:
583
583
 
584
584
  ```ts
585
585
  saveUser(input)
586
+ const result = saveUser(input)
586
587
  ```
587
588
 
588
589
  These are intentional:
589
590
 
590
591
  ```ts
591
- const result = saveUser(input)
592
592
  return saveUser(input)
593
593
  void saveUser(input)
594
+ saveUser(input).match(handleSaved, handleError)
594
595
  ```
595
596
 
597
+ The default mode is neverthrow-style `must-use`: it also reports assigned `Result` values that are
598
+ only passed around and never consumed with `match`, `unwrapOr`, `_unsafeUnwrap`, `isOk`, `isErr`,
599
+ returned, or explicitly discarded. Use `--mode direct` for the lower-noise expression-only check.
600
+
596
601
  For editor diagnostics, enable the TypeScript language-service plugin:
597
602
 
598
603
  ```json
599
604
  {
600
605
  "compilerOptions": {
601
- "plugins": [{ "name": "resultar-ls", "noDiscard": "error" }]
606
+ "plugins": [{ "name": "resultar-lint", "noDiscard": "error" }]
602
607
  }
603
608
  }
604
609
  ```
@@ -607,9 +612,9 @@ TypeScript language-service plugins are editor-only by default. To make `tsc` re
607
612
  diagnostics during builds, patch the local TypeScript installation:
608
613
 
609
614
  ```sh
610
- pnpm exec resultar-ls patch
611
- pnpm exec resultar-ls check
612
- pnpm exec resultar-ls unpatch
615
+ pnpm exec resultar-lint patch
616
+ pnpm exec resultar-lint doctor
617
+ pnpm exec resultar-lint unpatch
613
618
  ```
614
619
 
615
620
  For TypeScript 7 native-preview projects, `resultar-tsgo` exposes a `tsgo` wrapper that runs native
@@ -645,9 +650,9 @@ TypeScript and then Resultar no-discard validation.
645
650
  | Throw intentionally at a final edge | `unwrapOrThrow()` |
646
651
  | Default intentionally at a final edge | `unwrapOr(defaultValue)` |
647
652
 
648
- ## Version 3 Alpha Notes
653
+ ## Version 3 Notes
649
654
 
650
- `3.0.0-alpha.1` is a semver-major prerelease:
655
+ `3.0.0` is a semver-major release:
651
656
 
652
657
  - `no-discard` tooling moved out of the runtime package and into dedicated packages.
653
658
  - TypeScript peer support is now `>=6.0.0`.
@@ -667,26 +672,27 @@ and `tryResultAsync` in new code and docs.
667
672
 
668
673
  ## Documentation
669
674
 
670
- This README is the project entry point. For a full guide with larger examples and the complete API
671
- map, see [DOCUMENTATION.md](DOCUMENTATION.md).
675
+ This README is the runtime package entry point. For a full guide with larger examples and the
676
+ complete API map, see the repository documentation.
672
677
 
673
678
  More focused material:
674
679
 
675
- - [Type-safe error handling article, English](articles/en/type-safe.md)
676
- - [Artigo sobre tratamento de erros type-safe, Portuguese](articles/pt/type-safe.md)
677
- - [resultar-ls package guide](packages/resultar-ls/README.md)
678
- - [resultar-tsgo package guide](packages/resultar-tsgo/README.md)
680
+ - [Full guide](https://github.com/inaiat/resultar/blob/main/DOCUMENTATION.md)
681
+ - [Type-safe error handling article, English](https://github.com/inaiat/resultar/blob/main/articles/en/type-safe.md)
682
+ - [Artigo sobre tratamento de erros type-safe, Portuguese](https://github.com/inaiat/resultar/blob/main/articles/pt/type-safe.md)
683
+ - [resultar-lint package guide](https://github.com/inaiat/resultar/blob/main/packages/resultar-lint/README.md)
684
+ - [resultar-tsgo package guide](https://github.com/inaiat/resultar/blob/main/packages/resultar-tsgo/README.md)
679
685
 
680
- ## Workspace
686
+ ## Repository
681
687
 
682
688
  This repository is a pnpm workspace:
683
689
 
684
690
  - `packages/resultar`: Resultar runtime package.
685
- - `packages/resultar-ls`: TypeScript language-service diagnostics and no-discard CLI.
691
+ - `packages/resultar-lint`: TypeScript language-service diagnostics and no-discard CLI.
686
692
  - `packages/resultar-tsgo`: TypeScript 7 native-preview `tsgo` wrapper plus Resultar no-discard
687
693
  validation.
688
694
  - `benchmarks`: benchmark package.
689
- - `examples/language-service`: TypeScript 6 no-discard smoke example.
695
+ - `examples/resultar-lint`: TypeScript 6 no-discard smoke example.
690
696
  - `examples/tsgo`: TypeScript 7 native-preview smoke example.
691
697
 
692
698
  Common commands:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resultar",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0",
4
4
  "description": "Result pattern for TypeScript",
5
5
  "keywords": [
6
6
  "error-handling",