https://github.com/rstackjs/rsbuild-plugin-arethetypeswrong
Run `arethetypeswrong` to lint npm packages after the build.
https://github.com/rstackjs/rsbuild-plugin-arethetypeswrong
rsbuild rslib typescript
Last synced: 4 days ago
JSON representation
Run `arethetypeswrong` to lint npm packages after the build.
- Host: GitHub
- URL: https://github.com/rstackjs/rsbuild-plugin-arethetypeswrong
- Owner: rstackjs
- License: mit
- Created: 2025-08-10T03:49:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-11-23T09:11:34.000Z (about 2 months ago)
- Last Synced: 2025-12-31T20:14:17.480Z (12 days ago)
- Topics: rsbuild, rslib, typescript
- Language: TypeScript
- Homepage:
- Size: 103 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rstack - rsbuild-plugin-arethetypeswrong
README
# rsbuild-plugin-arethetypeswrong
Rsbuild plugin for checking TypeScript type definitions with [arethetypeswrong](https://github.com/arethetypeswrong/arethetypeswrong.github.io).
`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.

## Usage
Install:
```bash
npm add rsbuild-plugin-arethetypeswrong -D
```
Add plugin to your `rslib.config.ts` or `rsbuild.config.ts`:
```ts
import { pluginAreTheTypesWrong } from "rsbuild-plugin-arethetypeswrong";
export default {
plugins: [pluginAreTheTypesWrong()],
};
```
## Options
### enable
Whether to enable arethetypeswrong.
- Type: `boolean`
- Default: `true`
For example, only run arethetypeswrong in the CI environment:
```ts
pluginAreTheTypesWrong({
enable: Boolean(process.env.CI),
});
```
### areTheTypesWrongOptions
Options for arethetypeswrong. See [arethetypeswrong - Configuration](https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/packages/cli/README.md#configuration) for more details.
- Type:
```ts
interface areTheTypesWrongOptions {
ignoreRules?: ProblemFlag[];
ignoreResolutions?: ResolutionKind[];
summary?: boolean;
emoji?: boolean;
}
type ProblemFlag =
| "no-resolution"
| "untyped-resolution"
| "false-cjs"
| "false-esm"
| "cjs-resolves-to-esm"
| "fallback-condition"
| "cjs-only-exports-default"
| "named-exports"
| "false-export-default"
| "missing-export-equals"
| "unexpected-module-syntax"
| "internal-resolution-error";
type ResolutionKind = "node10" | "node16-cjs" | "node16-esm" | "bundler";
```
- Default:
```js
const defaultOptions = {
ignoreRules: [];
ignoreResolutions: [];
summary: true;
emoji: true;
};
```
- Example:
```js
pluginAreTheTypesWrong({
areTheTypesWrongOptions: {
ignoreRules: ["false-cjs"],
ignoreResolutions: ["node16-cjs"],
},
});
```
## Credits
Thanks to:
- [arethetypeswrong](https://github.com/arethetypeswrong/arethetypeswrong.github.io) for making this possible.
- [rsbuild-plugin-publint](https://github.com/rspack-contrib/rsbuild-plugin-publint) for the idea of linting as an Rsbuild plugin.
## License
[MIT](./LICENSE).