rsbuild-plugin-arethetypeswrong 0.0.0 → 0.1.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
@@ -10,6 +10,10 @@ Rsbuild plugin for checking TypeScript type definitions with [arethetypeswrong](
10
10
  <a href="https://npmcharts.com/compare/rsbuild-plugin-arethetypeswrong?minimal=true"><img src="https://img.shields.io/npm/dm/rsbuild-plugin-arethetypeswrong.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
11
11
  </p>
12
12
 
13
+ `rsbuild-plugin-arethetypeswrong` is the perfect partner for [Rslib](https://github.com/web-infra-dev/rslib). When building a library, arethetypeswrong helps you to analyze TypeScript types of the package to improve its compatibility with different module resolutions.
14
+
15
+ <img width="1000" height="761" alt="image" src="https://github.com/user-attachments/assets/cce68a0d-baac-45c5-8b59-9e7999932e1c" />
16
+
13
17
  ## Usage
14
18
 
15
19
  Install:
@@ -18,10 +22,9 @@ Install:
18
22
  npm add rsbuild-plugin-arethetypeswrong -D
19
23
  ```
20
24
 
21
- Add plugin to your `rsbuild.config.ts`:
25
+ Add plugin to your `rslib.config.ts` or `rsbuild.config.ts`:
22
26
 
23
27
  ```ts
24
- // rsbuild.config.ts
25
28
  import { pluginAreTheTypesWrong } from "rsbuild-plugin-arethetypeswrong";
26
29
 
27
30
  export default {
@@ -31,20 +34,81 @@ export default {
31
34
 
32
35
  ## Options
33
36
 
34
- ### foo
37
+ ### enable
38
+
39
+ Whether to enable arethetypeswrong.
40
+
41
+ - Type: `boolean`
42
+ - Default: `true`
35
43
 
36
- Some description.
44
+ For example, only run arethetypeswrong in the CI environment:
45
+
46
+ ```ts
47
+ pluginAreTheTypesWrong({
48
+ enable: Boolean(process.env.CI),
49
+ });
50
+ ```
51
+
52
+ ### areTheTypesWrongOptions
53
+
54
+ Options for arethetypeswrong. See [arethetypeswrong - Configuration](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/packages/cli/README.md#configuration) for more details.
55
+
56
+ - Type:
57
+
58
+ ```ts
59
+ interface areTheTypesWrongOptions {
60
+ ignoreRules?: ProblemFlag[];
61
+ ignoreResolutions?: ResolutionKind[];
62
+ summary?: boolean;
63
+ emoji?: boolean;
64
+ }
65
+
66
+ type ProblemFlag =
67
+ | "no-resolution"
68
+ | "untyped-resolution"
69
+ | "false-cjs"
70
+ | "false-esm"
71
+ | "cjs-resolves-to-esm"
72
+ | "fallback-condition"
73
+ | "cjs-only-exports-default"
74
+ | "named-exports"
75
+ | "false-export-default"
76
+ | "missing-export-equals"
77
+ | "unexpected-module-syntax"
78
+ | "internal-resolution-error";
79
+
80
+ type ResolutionKind = "node10" | "node16-cjs" | "node16-esm" | "bundler";
81
+ ```
82
+
83
+ - Default:
84
+
85
+ ```js
86
+ const defaultOptions = {
87
+ ignoreRules: [];
88
+ ignoreResolutions: [];
89
+ summary: true;
90
+ emoji: true;
91
+ };
92
+ ```
37
93
 
38
- - Type: `string`
39
- - Default: `undefined`
40
94
  - Example:
41
95
 
42
96
  ```js
43
97
  pluginAreTheTypesWrong({
44
- foo: "bar",
98
+ areTheTypesWrongOptions: {
99
+ ignoreRules: ["false-cjs"],
100
+ ignoreResolutions: ["node16-cjs"],
101
+ },
45
102
  });
46
103
  ```
47
104
 
105
+ ## Credits
106
+
107
+ Thanks to:
108
+
109
+ - [arethetypeswrong](https://github.com/arethetypeswrong/arethetypeswrong.github.io) for making this possible.
110
+ - [rsbuild-plugin-publint](https://github.com/rspack-contrib/rsbuild-plugin-publint) for the idea of linting as an Rsbuild plugin.
111
+
48
112
  ## License
49
113
 
50
114
  [MIT](./LICENSE).