microsoft / microsoft/TypeScript
Allow tsconfig.yaml in addition to tsconfig.json
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
Search Terms
yaml
tsconfig format
Suggestion
I suggest allowing the tsconfig.json file to be replaced with tsconfig.yaml.
This would be implemented by simply converting the yaml to json and passing it to whatever method currently interprets the contents of tsconfig.json.
Additionally, I would propose that the presence of both a tsconfig.json and a tsconfig.yaml file in the root of a project is an error.
Use Cases
Like #30400 (which I found originally), I'd like to add comments to my project config. Also, yaml is just a nicer format for something intended to be edited by a human.
I have created this simply because #30400 (which called for adding tsconfig.js) was closed for reasons which do not apply to yaml. So I thought there should be an open issue. You can always close it for other reasons, right?
Examples
following the example in the handbook
% cat example.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"files": [
"core.ts",
"sys.ts",
"types.ts",
"scanner.ts",
"parser.ts",
"utilities.ts",
"binder.ts",
"checker.ts",
"emitter.ts",
"program.ts",
"commandLineParser.ts",
"tsc.ts",
"diagnosticInformationMap.generated.ts"
]
}
% cat example.yaml
compilerOptions:
module: commonjs
noImplicitAny: true
removeComments: true
preserveConstEnums: true
sourceMap: true
files:
- core.ts
- sys.ts
- types.ts
- scanner.ts
- parser.ts
- utilities.ts
- binder.ts
- checker.ts
- emitter.ts
- program.ts
- commandLineParser.ts
- tsc.ts
- diagnosticInformationMap.generated.ts
Checklist
I'M PRETTY SURE 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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, nachzuverfolgen, wie das vorhandene Format von tsconfig.json gefunden und interpretiert wird, und verwende das Beispiel im Handbuch als erwartete Konfigurationsstruktur. Definiere die Fertigstellung so, dass ein gleichwertiges tsconfig.yaml akzeptiert wird und ein Fehler gemeldet wird, wenn beide Konfigurationsdateien vorhanden sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript, yaml
- Bereich
- compilers, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100