Skip to content

feat: add support for include and exclude paths in typescript configuration#317

Open
kumikumi wants to merge 2 commits into
fi3ework:mainfrom
kumikumi:typescript-include-exclude
Open

feat: add support for include and exclude paths in typescript configuration#317
kumikumi wants to merge 2 commits into
fi3ework:mainfrom
kumikumi:typescript-include-exclude

Conversation

@kumikumi

Copy link
Copy Markdown

Implements the TypeScript side of #182

Until TypeScript adds support for excluding files or directories from typechecking (see my comment for my use case at microsoft/TypeScript#40426 (comment) ), the best we can do is to filter out the errors in the checker plugins.

I have implemented the "exclude" and "include" options to do just that.

The VueTsc side seems similar to the regular TypeScript checker at a glance, I didn't touch it yet because I'm not using Vue. I might implement it as well if there's interest. I'd need to make a repro for that.

@changeset-bot

changeset-bot Bot commented May 11, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 27b38f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vite-plugin-checker Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented May 11, 2024

Copy link
Copy Markdown

Deploy Preview for vite-plugin-checker ready!

Name Link
🔨 Latest commit 27b38f7
🔍 Latest deploy log https://app.netlify.com/sites/vite-plugin-checker/deploys/663f76ca93d261000853376f
😎 Deploy Preview https://deploy-preview-317--vite-plugin-checker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mbonaci

mbonaci commented Nov 10, 2025

Copy link
Copy Markdown

Based on this PR, do I conclude that this plugin was abandoned?

@danielroe

Copy link
Copy Markdown
Collaborator

no, this plugin is not abandoned, as you can see from checking the releases

@mbonaci

mbonaci commented Nov 11, 2025

Copy link
Copy Markdown

@danielroe can this PR be merged?
IIUC, merging it would make it possible to avoid: #568

Since TS isn't keen on doing it on the tsconfig level: microsoft/TypeScript#40426 (comment)

This is my surface-level observation, so it's possible that I reached incorrect conclusions here.

@danielroe

Copy link
Copy Markdown
Collaborator

i don't think this would solve that.

exclude only prevents files from being included via include - it does not prevent files in node_modules from being checked if they are pulled into the project by being referenced in source files which are in the project

@mbonaci

mbonaci commented Nov 11, 2025

Copy link
Copy Markdown

Am I then doing something wrong when vite-plugin-checker reports its own dependency (deep) as missing:

 ERROR(TypeScript)  Cannot find module 'stylelint' or its corresponding type declarations.
 FILE  /abs-path/frontend/node_modules/.pnpm/vite-plugin-checker@0.11.0_oxlint@1.26.0_oxlint-tsgolint@0.5.0__typescript@5.9.3_vite@7_f802711bcf76c6cc3ce135b58b23069b/node_modules/vite-plugin-checker/dist/types.d.ts:3:28

    1 | import { Worker } from 'node:worker_threads';
    2 | import { ESLint } from 'eslint';
  > 3 | import * as Stylelint from 'stylelint';
      |                            ^^^^^^^^^^^
    4 | import { ConfigEnv, ErrorPayload } from 'vite';
    5 | import { VlsOptions } from './checkers/vls/initParams.js';
    6 | import 'vscode-languageserver/node';

Sorry to repost this snippet here, but I can't find my way out of this one.

BTW when I do tsc --skipLibCheck --noEmit I don't get this error.

@danielroe

danielroe commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

you probably want to enable skipLibCheck in your tsconfig.json or install stylelint (it's not a dependency of this plugin)

@mbonaci

mbonaci commented Nov 12, 2025

Copy link
Copy Markdown

@danielroe Yeah, I'll probably end up adding skipLibCheck to my TS config, even though I wanted to avoid that, but AFAICS two of the 4 errors do come from within this plugin, even though one of them (stylelint) is declared as an optional peer dependency and the other (vscode-languageserver) as a dev dependency:

 ERROR(TypeScript)  Cannot find module 'vscode-languageserver/node' or its corresponding type declarations.
 FILE  /abs-path/frontend/node_modules/.pnpm/vite-plugin-checker@0.11.0_oxlint@1.26.0_oxlint-tsgolint@0.5.0__typescript@5.9.3_vite@7_f802711bcf76c6cc3ce135b58b23069b/node_modules/vite-plugin-checker/dist/checkers/vls/initParams.d.ts:1:34

  > 1 | import { InitializeParams } from 'vscode-languageserver/node';
      |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 | import { URI } from 'vscode-uri';
    3 |
    4 | type VlsOptions = ReturnType<typeof getDefaultVLSConfig>;

 ERROR(TypeScript)  Cannot find module 'stylelint' or its corresponding type declarations.
 FILE  /abs-path/frontend/node_modules/.pnpm/vite-plugin-checker@0.11.0_oxlint@1.26.0_oxlint-tsgolint@0.5.0__typescript@5.9.3_vite@7_f802711bcf76c6cc3ce135b58b23069b/node_modules/vite-plugin-checker/dist/types.d.ts:3:28

    1 | import { Worker } from 'node:worker_threads';
    2 | import { ESLint } from 'eslint';
  > 3 | import * as Stylelint from 'stylelint';
      |                            ^^^^^^^^^^^
    4 | import { ConfigEnv, ErrorPayload } from 'vite';
    5 | import { VlsOptions } from './checkers/vls/initParams.js';
    6 | import 'vscode-languageserver/node';

[TypeScript] Found 4 errors. Watching for file changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants