microsoft / microsoft/TypeScript

Support finding a `jsconfig.json` with `tsc -p .`

Aperta
#41,350 3 commenti 18 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

Search Terms

jsconfig project

Suggestion

When I run tsc -p . on a JavaScript project with jsconfig.json and // @ts-check with JSDoc it complains about not finding a tsconfig.json

Currently I have to run tsc -p jsconfig.json --maxNodeModuleJsDepth 0 to check my JavaScript project.

~/projects/sync-wait-group on master*
$ tsc -p .
error TS5057: Cannot find a tsconfig.json file at the specified directory: '.'.

It tells me that tsconfig.json does not exist.

Adding detection for jsconfig.json and turning --maxNodeModuleJsDepth 0 on by default ( which we do for tsconfig.json but not jsconfig.json ) would be a good user experience improvmenent.

Use Cases

Being able to use the tsc cli on a JavaScript + JSDoc project.

Examples

tsc -p . will "just work" for a JavaScript project.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il comportamento segnalato di tsc -p . in un progetto JavaScript contenente jsconfig.json e // @ts-check con JSDoc. Traccia il modo in cui la CLI tsc risolve la configurazione del progetto e applica maxNodeModuleJsDepth; il lavoro è concluso quando tsc -p . individua jsconfig.json e utilizza il valore predefinito previsto senza richiedere flag espliciti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
cli, compilers
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.