Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
# Run `npm run bump` to bump the version and create a git tag.
push:
tags:
- "v*"
- 'v*'

workflow_dispatch:

Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
run_install: true

- name: Build Packages
run: pnpm build
run: node --run build

- name: Publish
run: pnpm stage publish --no-git-checks
13 changes: 5 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ jobs:
run_install: true

- name: Build
run: pnpm build
run: node --run build

- name: Format check
uses: dprint/check@9cb3a2b17a8e606d37aae341e49df3654933fc23 # v2.3

- name: Run Lint
run: pnpm run lint
- name: Run Check
run: node --run check

test:
runs-on: ${{ matrix.os }}
Expand All @@ -68,7 +65,7 @@ jobs:
run_install: true

- name: Build
run: pnpm build
run: node --run build

- name: Run Test
run: pnpm run test --test-timeout=30000
run: node --run test -- --test-timeout=30000
2 changes: 0 additions & 2 deletions .husky/pre-commit

This file was deleted.

1 change: 1 addition & 0 deletions .rstack/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rs staged
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["dprint.dprint"]
"recommendations": ["rstack.rstack"]
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"search.useIgnoreFiles": true,
"editor.defaultFormatter": "dprint.dprint",
"editor.defaultFormatter": "rstack.rstack"
}
16 changes: 8 additions & 8 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ This repository contains `rsbuild-plugin-arethetypeswrong`, a plugin for checkin
This project uses `pnpm` (version 10+) as its package manager. Always use `pnpm` instead of `npm` or `yarn`.

- **Install Dependencies:** `pnpm install`
- **Build the Plugin:** `pnpm build` (Runs `rslib build` under the hood)
- **Build the Plugin:** `pnpm build` (Runs `rs lib` under the hood)

The plugin is built as an ESM package. Pay attention to `.js` vs `.ts` extensions in internal imports. Since the project has `"type": "module"` and `moduleResolution: node16` in `tsconfig.json`, local imports in source files must include the `.js` extension (e.g., `import "./createTarball.js"`).

## 🧪 Testing

We use **rstest** (`@rstest/core`) for testing. Tests are located in the `test/` directory.
We use **Rstest** through Rstack CLI for testing. Tests are located in the `test/` directory.

- **Run All Tests:** `pnpm test` (runs with coverage)
- **Run a Single Test:** `pnpm exec rstest test/path-to-test/index.test.ts`
- **Update Snapshots:** `pnpm exec rstest -u`
- **Run a Single Test:** `pnpm exec rs test test/path-to-test/index.test.ts`
- **Update Snapshots:** `pnpm exec rs test -u`

**Testing Guidelines:**

- Most tests are integration tests that create an Rsbuild instance with the plugin and check the output.
- Assertions typically involve spying on `logger.success` or `logger.error`, filtering the messages for `[arethetypeswrong]`, stripping VT control characters, and running snapshot tests (`toMatchSnapshot()`).
- Use `rs.spyOn(logger, "...")` from `@rstest/core` to capture console outputs. Ensure to clean up mocks using `rs.restoreAllMocks()` in `beforeEach()`.
- Use `rs.spyOn(logger, "...")` from `rstack/test` to capture console outputs. Ensure to clean up mocks using `rs.restoreAllMocks()` in `beforeEach()`.

## 🧹 Linting & Formatting

- **Linting:** We use `rslint` (powered by `@typescript-eslint` via `rslint.jsonc`).
- **Linting:** We use Rslint through Rstack CLI.
- Command: `pnpm lint`
- **Formatting:** We use `dprint` for highly-performant code formatting.
- Command: `npx dprint fmt` (or let `nano-staged` handle it on commit)
- **Formatting:** We use Rstack CLI's formatter.
- Command: `pnpm format` (or let `rs staged` handle it on commit)
- **Code standards:** Never leave unused variables, imports, or dead code. `rslint` enforces these rules strictly.

## 🎨 Code Style & Conventions
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm add rsbuild-plugin-arethetypeswrong -D
Add plugin to your `rslib.config.ts` or `rsbuild.config.ts`:

```ts
import { pluginAreTheTypesWrong } from "rsbuild-plugin-arethetypeswrong";
import { pluginAreTheTypesWrong } from 'rsbuild-plugin-arethetypeswrong';

export default {
plugins: [pluginAreTheTypesWrong()],
Expand Down Expand Up @@ -64,20 +64,20 @@ interface areTheTypesWrongOptions {
}

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";
| '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:
Expand All @@ -96,8 +96,8 @@ const defaultOptions = {
```js
pluginAreTheTypesWrong({
areTheTypesWrongOptions: {
ignoreRules: ["false-cjs"],
ignoreResolutions: ["node16-cjs"],
ignoreRules: ['false-cjs'],
ignoreResolutions: ['node16-cjs'],
},
});
```
Expand Down
38 changes: 0 additions & 38 deletions dprint.jsonc

This file was deleted.

30 changes: 10 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,25 @@
"dist"
],
"scripts": {
"build": "rslib",
"lint": "rslint",
"prepare": "husky",
"test": "rstest --coverage"
},
"nano-staged": {
"*.{js,jsx,ts,tsx,mjs,cjs,md,json,jsonc,yml,yaml}": [
"dprint fmt --allow-no-files --"
],
"*.{js,jsx,ts,tsx,mjs,cjs}": [
"rslint"
]
"build": "rs lib",
"bump": "pnpx bumpp",
"check": "rs check",
"dev": "rs lib -w",
"format": "rs fmt",
"lint": "rs lint",
"prepare": "rs hooks",
"test": "rs test --coverage"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.18.5",
"@microsoft/api-extractor": "^7.59.0",
"@rsbuild/core": "2.2.1",
"@rslib/core": "^0.23.2",
"@rslint/core": "^0.9.0",
"@rstest/adapter-rslib": "^0.11.11",
"@rstest/core": "^0.11.11",
"@rsbuild/core": "^2.2.2",
"@rstest/coverage-istanbul": "^0.11.11",
"@types/node": "^24.13.3",
"cli-table3": "^0.6.5",
"dprint": "^0.56.1",
"husky": "^9.1.7",
"nano-staged": "^1.0.2",
"package-manager-detector": "^1.8.0",
"rsbuild-plugin-publint": "^1.0.0",
"rstack": "^0.7.2",
"tinyexec": "^1.3.0",
"typescript": "^7.0.2"
},
Expand Down
Loading