rstackjs / rstackjs/rsbuild-plugin-type-check

same error log twice when async is true

Open
#33 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
13
Forks
6
Avg merge
3h 32m
Merged PRs (30d)
6

Description

复现步骤:

import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
import { defineConfig } from '@rslib/core';

export default defineConfig({
    lib: [
        {
            format: 'esm',
            bundle: false,
            shims: {
                esm: {
                    require: true,
                    __filename: true,
                    __dirname: true,
                },
            },
            autoExtension: false,
            output: {
                target: 'node',
                distPath: {
                    root: './dist/esm',
                },
                filename: {
                    js: '[name].mjs',
                },
            },
        },
        {
            format: 'cjs',
            bundle: false,
            autoExtension: false,
            output: {
                target: 'node',
                distPath: {
                    root: './dist/cjs',
                },
                filename: {
                    js: '[name].cjs',
                },
            },
        },
    ],
    plugins: [
        // https://github.com/rspack-contrib/rsbuild-plugin-type-check
        pluginTypeCheck({
            enable: true,
            tsCheckerOptions: {
                async: true,
                formatter: { type: 'codeframe', pathType: 'absolute' },
                typescript: {
                    typescriptPath: require.resolve('typescript'),
                },
                logger: {
                    log(message) {
                        console.log(message);
                    },
                    error(message: string) {
                        console.log(message);
                    },
                },
            },
        }),
    ],
});
const a: number = '';

注意观察时间,当连续保存同一个文件的时候,一次保存将有概率导致两次输出

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the pluginTypeCheck integration and its handling of tsCheckerOptions.async, then reproduce the issue with the provided configuration and the invalid const a: number = '' assignment. Repeatedly save the same file and compare the logger output; done means each save reports the type error only once.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.