Skip to content
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

Rename TSConfig option categories #42514

Merged
merged 14 commits into from
Jun 3, 2021
250 changes: 128 additions & 122 deletions src/compiler/commandLineParser.ts

Large diffs are not rendered by default.

86 changes: 58 additions & 28 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4581,34 +4581,6 @@
"category": "Message",
"code": 6171
},
"Basic Options": {
"category": "Message",
"code": 6172
},
"Strict Type-Checking Options": {
"category": "Message",
"code": 6173
},
"Module Resolution Options": {
"category": "Message",
"code": 6174
},
"Source Map Options": {
"category": "Message",
"code": 6175
},
"Additional Checks": {
"category": "Message",
"code": 6176
},
"Experimental Options": {
"category": "Message",
"code": 6177
},
"Advanced Options": {
"category": "Message",
"code": 6178
},
"Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'.": {
"category": "Message",
"code": 6179
Expand Down Expand Up @@ -4866,6 +4838,64 @@
"code": 6242
},

"Modules": {
orta marked this conversation as resolved.
Show resolved Hide resolved
"category": "Message",
"code": 6250
},
"File Management": {
"category": "Message",
"code": 6251
},
"Emit": {
"category": "Message",
"code": 6252
},
"JavaScript Support": {
"category": "Message",
"code": 6253
},
"Type Checking": {
"category": "Message",
"code": 6254
},
"Editor Support": {
"category": "Message",
"code": 6255
},
"Watch and Build Modes": {
"category": "Message",
"code": 6256
},
"Compiler Diagnostics": {
"category": "Message",
"code": 6257
},
"Interop Constraints": {
"category": "Message",
"code": 6259
},
"Backwards Compatibility": {
"category": "Message",
"code": 6261
},
"Language and Environment": {
"category": "Message",
"code": 6262
},
"Projects": {
"category": "Message",
"code": 6263
},
"Output Formatting": {
"category": "Message",
"code": 6264
},
"Completeness": {
"category": "Message",
"code": 6265
},


"Projects to reference": {
"category": "Message",
"code": 6300
Expand Down
2 changes: 1 addition & 1 deletion src/testRunner/unittests/config/commandLineParsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ namespace ts {
name: "optionName",
type: type(),
isTSConfigOnly: true,
category: Diagnostics.Basic_Options,
category: Diagnostics.Backwards_Compatibility,
description: Diagnostics.Enable_project_compilation,
}
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"compilerOptions": {
"locale": "someString"
}
"compilerOptions": {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that it was shown before and not now..

Copy link
Contributor Author

@orta orta Jan 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, locale used to be an Advanced Option which meant it would have passed that previous if check - but the flag only works on the CLI (and so it's not in the tsconfig reference for example), so I felt moving it into command line options was probably the right call

            name: "locale",
             type: "string",
-            category: Diagnostics.Advanced_Options,
+            category: Diagnostics.Command_line_Options,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not command line only option... it can be present in tsconfig ?

Copy link
Contributor Author

@orta orta May 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirmed to make sure, tsc ignores locale in a tsconfig

❯ cat tsconfig.json
{
  "files": [
    "broke.ts"
  ],
  "compilerOptions": {
    "locale": "cs",
  }
}

❯ pnpm tsc
broke.ts:2:7 - error TS1134: Variable declaration expected.

2 const 123 = 123
        ~~~


Found 1 error.


❯ pnpm tsc --locale cs
broke.ts:2:7 - error TS1134: Očekává se deklarace proměnné.

2 const 123 = 123
        ~~~


Našla se 1 chyba.

and just in case it's a top level attribute:

❯ cat tsconfig.json
{
  "files": [
    "broke.ts"
  ],
  "locale": "cs",
}

❯ pnpm tsc
broke.ts:2:7 - error TS1134: Variable declaration expected.

2 const 123 = 123
        ~~~


Found 1 error.

It can be considered a bug? but the switch at least makes sense for how TS acts today

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"compilerOptions": {}
"compilerOptions": {
"pretty": true
orta marked this conversation as resolved.
Show resolved Hide resolved
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.