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
213 changes: 106 additions & 107 deletions src/compiler/commandLineParser.ts

Large diffs are not rendered by default.

80 changes: 52 additions & 28 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4465,34 +4465,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 @@ -5311,6 +5283,58 @@
"category": "Error",
"code": 9006
},
"Modules": {
orta marked this conversation as resolved.
Show resolved Hide resolved
"category": "Message",
"code": 9100
},
"File Management": {
"category": "Message",
"code": 9101
},
"Emit": {
"category": "Message",
"code": 9102
},
"JavaScript Support": {
"category": "Message",
"code": 9103
},
"Type Checking": {
"category": "Message",
"code": 9104
},
"Editor Support": {
"category": "Message",
"code": 9105
},
"Watch and Build Modes": {
"category": "Message",
"code": 9106
},
"Debugging the Compiler": {
"category": "Message",
"code": 9107
},
"Strictness - Linters": {
"category": "Message",
"code": 9108
},
"Interop Constraints": {
"category": "Message",
"code": 9109
},
"Strictness": {
"category": "Message",
"code": 9110
},
"Backwards Compatibility": {
"category": "Message",
"code": 9111
},
"Language": {
"category": "Message",
"code": 9112
},
"JSX attributes must only be assigned a non-empty 'expression'.": {
"category": "Error",
"code": 17000
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 @@ -515,7 +515,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
Expand Up @@ -2,29 +2,68 @@
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
/* Language */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
// "jsxFactory": "", /* Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX fragment factory function to use when targeting 'react' JSX emit with 'jsxFactory' compiler option is specified, e.g. 'Fragment'. */
// "jsxImportSource": "", /* Specify the module specifier to be used to import the `jsx` and `jsxs` factory functions from. eg, react */
// "resolveJsonModule": true, /* Include modules imported with '.json' extension */
// "noLib": true, /* Do not include the default library file (lib.d.ts). */

/* Modules */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "noResolve": true, /* Do not add triple-slash references or imported modules to the list of compiled files. */

/* JavaScript Support */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
// "maxNodeModuleJsDepth": 1, /* The maximum dependency depth to search under node_modules and load JavaScript files. */

/* Emit */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "emitDeclarationOnly": true, /* Only emit '.d.ts' declaration files. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
// "newLine": "crlf", /* Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix). */
// "stripInternal": true, /* Do not emit declarations for code that has an '@internal' annotation. */
// "noImplicitUseStrict": true, /* Do not emit 'use strict' directives in module output. */
// "noEmitHelpers": true, /* Do not generate custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Do not emit outputs if any errors were reported. */
// "declarationDir": "./", /* Output directory for generated declaration files. */
// "useDefineForClassFields": true, /* Emit class fields with Define instead of Set. */

/* Interop Constraints */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "preserveConstEnums": true, /* Do not erase const enum declarations in generated code. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */

/* Strict Type-Checking Options */
/* Strictness */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
Expand All @@ -34,38 +73,18 @@
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
/* Strictness - Linters */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
// "allowUnusedLabels": true, /* Do not report errors on unused labels. */
// "allowUnreachableCode": true, /* Do not report errors on unreachable code. */

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
/* Type Checking */
// "noErrorTruncation": true, /* Do not truncate error messages. */
"skipLibCheck": true /* Skip type checking of declaration files. */
}
}
Loading