microsoft / microsoft/TypeScript
Suggestion: an option to make --showConfig more verbose
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Mô tả
Search Terms
showConfig, verbose, verbosity
Suggestion
Currently, the --showConfig option will only print the compiler options that are provided by the given tsconfig.json.
The suggestion is to introduce another command line option to use together with --showConfig, for example --verbose, that would additionally print out the default values of all of the missing compiler options.
Use Cases
This new option hopes to make debugging configuration files easier by explicitly displaying the value of every compiler option.
Examples
Given the following folder structure:
.
├── main.ts
└── tsconfig.json
And the following tsconfig.json:
{
"compilerOptions": {
"target": "es5"
},
"include": ["**/*.ts"]
}
Running the command tsc --showConfig produces:
{
"compilerOptions": {
"target": "es5"
},
"files": [
"./main.ts"
],
"include": [
"**/*.ts"
]
}
Here's an example output of tsc --showConfig --verbose. It was derived in the following way:
- Use the Typescript Handbook's table of compiler options and their defaults as a reference.
- Exclude deprecated options (
out,reactNamespace, andskipDefaultLibCheck) - Also exclude any options that are missing a default value in the table, since JSON doesn't have a notion of
undefined.
{
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": false,
"allowUmdGlobalAccess": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": false,
"build": false,
"charset": "utf8",
"checkJs": false,
"composite": true,
"declaration": false,
"declarationMap": false,
"diagnostics": false,
"disableSizeLimit": false,
"downlevelIteration": false,
"emitBOM": false,
"emitDeclarationOnly": false,
"emitDecoratorMetadata": false,
"esModuleInterop": false,
"experimentalDecorators": false,
"extendedDiagnostics": false,
"forceConsistentCasingInFileNames": false,
"importHelpers": false,
"incremental": false,
"inlineSourceMap": false,
"inlineSources": false,
"isolatedModules": false,
"jsx": "preserve",
"jsxFactory": "React.createElement",
"keyofStringsOnly": false,
"listEmittedFiles": false,
"listFiles": false,
"locale": "en", // [2]
"module": "commonjs",
"moduleResolution": "classic",
"newLine": "lf", // [2]
"noEmit": false,
"noEmitHelpers": false,
"noEmitOnError": false,
"noErrorTruncation": false,
"noFallthroughCasesInSwitch": false,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitThis": false,
"noImplicitUseStrict": false,
"noLib": false,
"noResolve": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveConstEnums": false,
"preserveSymlinks": false,
"preserveWatchOutput": false,
"pretty": true, // [1]
"removeComments": false,
"resolveJsonModule": false,
"rootDir": "(computed from the list of input files)", // [3]
"showConfig": false,
"skipLibCheck": false,
"sourceMap": false,
"strict": false,
"strictBindCallApply": false,
"strictFunctionTypes": false,
"strictPropertyInitialization": false,
"strictNullChecks": false,
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"target": "es5",
"traceResolution": false,
"tsBuildInfoFile": ".tsbuildinfo"
},
"files": [
"./main.ts"
],
"include": [
"**/*.ts"
]
}
[1] The Handbook says pretty should be true unless piping or redirecting output to file, so the desired value here may be ambiguous?
[2] locale and newLine are platform-specific.
[3] rootDir would need to be calculated so it can be displayed.
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xem xét hành vi hiện tại của tsc --showConfig và các giá trị mặc định của tùy chọn trình biên dịch trong Handbook được tham chiếu trong issue. Xác định cách --verbose biểu diễn các tùy chọn dành riêng cho nền tảng, được tính toán, không còn được khuyến nghị và chưa được định nghĩa; được xem là hoàn thành khi lệnh luôn hiển thị các giá trị mặc định theo dự định mà không thay đổi đầu ra thông thường của --showConfig. Không có tệp nguồn hoặc bài kiểm thử nào được nêu tên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- typescript
- Lĩnh vực
- cli, developer-experience
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100