Skip to content

fix(website): acquired types are shown in the editor but not reflected in linting #11198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mdm317
Copy link
Contributor

@mdm317 mdm317 commented May 9, 2025

PR Checklist

Overview

I think this issue occurs because of differences in the properties used when creating a ts.Program between Monaco and TypeScript-VFS.

return vfs.createVirtualTypeScriptEnvironment(

The modules like monaco, [typescript]
(https://github.com/microsoft/TypeScript), and typescript-website are scattered, so it’s a bit confusing

1. create ts.program by monace

When monaco-editor creating this code will excute link
private _languageService = ts.createLanguageService(this);

createLanguageService in typescript. link

const rootFileNames = host.getScriptFileNames().slice();
 // some code
const options: CreateProgramOptions = {
  rootNames: rootFileNames,
  options: newSettings,
  host: compilerHost, 
  oldProgram: program,
  projectReferences,
};
program = createProgram(options);

And filenames output by getScriptFileNames will be added in the code below.
defaults.addExtraLib(code, path) in typescript-website => defaults.addExtraLib(code, path) in monaco

So, when creating a ts.Program, the rootNames array includes some libraries, such as Node or React.

2. create ts.program by TypeScript-VFS.

const registeredFiles = new Set<string>();
const createEnv = (
compilerOptions: ts.CompilerOptions,
): tsvfs.VirtualTypeScriptEnvironment => {
return vfs.createVirtualTypeScriptEnvironment(
system,
[...registeredFiles],

Unlike case 1 above,We don't pass the name of a node_modules folder in fileNames.

In the sentence above, I modified it so that rootNames are provided when creating the ts.Program for both the Editor and Linting

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @mdm317!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link

netlify bot commented May 9, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 529ce80
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/681e340423282000084a457d
😎 Deploy Preview https://deploy-preview-11198--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 85 (🔴 down 14 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

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

Copy link

nx-cloud bot commented May 9, 2025

View your CI Pipeline Execution ↗ for commit 529ce80.

Command Status Duration Result
nx typecheck ast-spec ✅ Succeeded <1s View ↗
nx run-many --target=build --exclude website --... ✅ Succeeded 2s View ↗
nx run-many --target=clean ✅ Succeeded 10s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-09 19:34:12 UTC

@kirkwaiblinger kirkwaiblinger changed the title fix(website): Acquired types are shown in the editor but not reflected in linting fix(website): acquired types are shown in the editor but not reflected in linting May 9, 2025
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.

Bug(website): Acquired types are shown in the editor but not reflected in linting
1 participant