microsoft / microsoft/TypeScript

Configure from package.json

Aperta
#32,830 65 commenti 241 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
1g 19h
PR unite (30g)
117

Descrizione

Search Terms

package.json, config, configuration, tsconfig

Suggestion

Allow package.json as an alternate source for tsconfig.json options. To be clear, I am requesting that you please re-evaluate #6590 - it has been 2 years since that issue was posted, so interests may have changed and I believe this feature holds good value.

UPDATE: 2022-04-28

Please vote how you would like to see this feature implemented here: https://github.com/microsoft/TypeScript/issues/32830#issuecomment-1112372061

Use Cases

What do you want to use this for?

Provide a broader configuration support and decluttering the project root of configuration files that can easily be moved to package.json.

What shortcomings exist with current approaches?

Some users prefer to store their all their configuration files in 1 larger file. Right now, that is not an option.

Examples

Example of what the package.json would look like.

{
	"name": "example",
	"version": "1.0.0",
	"description": "This is an example",
	"license": "MIT",
	"tsconfig": {
		"compilerOptions": {
			"module": "commonjs",
			"moduleResolution": "node",
			"outDir": ".build",
			"pretty": true,
			"rootDir": "./",
			"sourceMap": true,
			"target": "ES5",
			"strict": true
		},
		"exclude": [
			"node_modules"
		],
		"include": [
			"index.ts",
			"src/**/*"
		]
	}
}

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 leggendo la issue correlata #6590 e la discussione di 65 commenti, incluso il sondaggio sull’implementazione, per comprendere le scelte di progettazione ancora irrisolte. La issue sarà completa quando TypeScript sarà in grado di individuare e applicare in modo coerente le opzioni tsconfig richieste dalla proprietà tsconfig in package.json.

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

Valutazione

Stack tecnologico
typescript
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.