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

Update tsconfig/jsonconfig/package.json for TS 5.0 #2754

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 36 additions & 3 deletions src/schemas/json/jsconfig.json
Expand Up @@ -207,6 +207,16 @@
"type": "object",
"description": "Instructs the TypeScript compiler how to compile .ts files.",
"properties": {
"allowArbitraryExtensions": {
"description": "Enable importing files with any extension, provided a declaration file is present.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"description": "Enable importing files with any extension, provided a declaration file is present.",
"description": "Whether to enable importing files with any extension, provided a declaration file is present.",

Optional fix: descriptions for keys representing boolean options can begin with Whether to.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a good standard for booleans, but I think it is more important for the descriptions to match the command-line help text produced by tsc, even if it's non-standard.

"type": "boolean",
"markdownDescription": "Enable importing files with any extension, provided a declaration file is present.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions"
},
"allowImportingTsExtensions": {
"description": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.",
"type": "boolean",
"markdownDescription": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions"
},
"charset": {
"description": "No longer supported. In early versions, manually set the text encoding for reading files.",
"type": "string",
Expand All @@ -218,6 +228,11 @@
"default": true,
"markdownDescription": "Enable constraints that allow a TypeScript project to be used with project references.\n\nSee more: https://www.typescriptlang.org/tsconfig#composite"
},
"customConditions": {
"description": "Conditions to set in addition to the resolver-specific defaults when resolving imports.",
"type": "string",
"markdownDescription": "Conditions to set in addition to the resolver-specific defaults when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#customConditions"
},
"declaration": {
"description": "Generate .d.ts files from TypeScript and JavaScript files in your project.",
"type": "boolean",
Expand Down Expand Up @@ -360,10 +375,10 @@
"type": "string",
"anyOf": [
{
"enum": ["Classic", "Node", "Node16", "NodeNext"]
"enum": ["classic", "node", "node16", "nodenext", "bundler"]
},
{
"pattern": "^(([Nn]ode)|([Nn]ode16)|([Nn]ode[Nn]ext)|([Cc]lassic))$"
"pattern": "^(([Nn]ode)|([Nn]ode16)|([Nn]ode[Nn]ext)|([Cc]lassic)|([Bb]undler))$"
}
],
"default": "classic",
Expand Down Expand Up @@ -554,11 +569,12 @@
"ES2020",
"ES2021",
"ES2022",
"ES2023",
"ESNext"
]
},
{
"pattern": "^([Ee][Ss]([356]|(20(1[56789]|2[012]))|[Nn][Ee][Xx][Tt]))$"
"pattern": "^([Ee][Ss]([356]|(20(1[56789]|2[0123]))|[Nn][Ee][Xx][Tt]))$"
}
],
"markdownDescription": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.\n\nSee more: https://www.typescriptlang.org/tsconfig#target"
Expand Down Expand Up @@ -981,6 +997,18 @@
"default": false,
"markdownDescription": "Enable importing .json files\n\nSee more: https://www.typescriptlang.org/tsconfig#resolveJsonModule"
},
"resolvePackageJsonExports": {
"description": "Use the package.json 'exports' field when resolving package imports.",
"type": "boolean",
"default": false,
"markdownDescription": "Use the package.json 'exports' field when resolving package imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports"
},
"resolvePackageJsonImports": {
"description": "Use the package.json 'imports' field when resolving imports.",
"type": "boolean",
"default": false,
"markdownDescription": "Use the package.json 'imports' field when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonImports"
},
"assumeChangesOnlyAffectDirectDependencies": {
"description": "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it. Requires TypeScript version 3.8 or later.",
"type": "boolean"
Expand All @@ -1004,6 +1032,11 @@
"description": "Opt a project out of multi-project reference checking when editing.",
"type": "boolean",
"markdownDescription": "Opt a project out of multi-project reference checking when editing.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSolutionSearching"
},
"verbatimModuleSyntax": {
"description": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.",
"type": "boolean",
"markdownDescription": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.\n\nSee more: https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax"
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/schemas/json/package.json
Expand Up @@ -99,6 +99,10 @@
"default": {
"$ref": "#/definitions/packageExportsEntryOrFallback",
"description": "The module path that is resolved when no other export type matches."
},
"types": {
"$ref": "#/definitions/packageExportsEntryOrFallback",
"description": "The module path that is resolved for TypeScript types when this specifier is imported. Should be listed before other conditions."
}
},
"patternProperties": {
Expand Down
39 changes: 36 additions & 3 deletions src/schemas/json/tsconfig.json
Expand Up @@ -210,6 +210,16 @@
"type": "object",
"description": "Instructs the TypeScript compiler how to compile .ts files.",
"properties": {
"allowArbitraryExtensions": {
"description": "Enable importing files with any extension, provided a declaration file is present.",
"type": "boolean",
"markdownDescription": "Enable importing files with any extension, provided a declaration file is present.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions"
},
"allowImportingTsExtensions": {
"description": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.",
"type": "boolean",
"markdownDescription": "Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.\n\nSee more: https://www.typescriptlang.org/tsconfig#allowImportingTsExtensions"
},
"charset": {
"description": "No longer supported. In early versions, manually set the text encoding for reading files.",
"type": "string",
Expand All @@ -221,6 +231,11 @@
"default": true,
"markdownDescription": "Enable constraints that allow a TypeScript project to be used with project references.\n\nSee more: https://www.typescriptlang.org/tsconfig#composite"
},
"customConditions": {
"description": "Conditions to set in addition to the resolver-specific defaults when resolving imports.",
"type": "string",
"markdownDescription": "Conditions to set in addition to the resolver-specific defaults when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#customConditions"
},
"declaration": {
"description": "Generate .d.ts files from TypeScript and JavaScript files in your project.",
"type": "boolean",
Expand Down Expand Up @@ -363,10 +378,10 @@
"type": "string",
"anyOf": [
{
"enum": ["Classic", "Node", "Node16", "NodeNext"]
"enum": ["classic", "node", "node16", "nodenext", "bundler"]
},
{
"pattern": "^(([Nn]ode)|([Nn]ode16)|([Nn]ode[Nn]ext)|([Cc]lassic))$"
"pattern": "^(([Nn]ode)|([Nn]ode16)|([Nn]ode[Nn]ext)|([Cc]lassic)|([Bb]undler))$"
}
],
"default": "classic",
Expand Down Expand Up @@ -557,11 +572,12 @@
"ES2020",
"ES2021",
"ES2022",
"ES2023",
"ESNext"
]
},
{
"pattern": "^([Ee][Ss]([356]|(20(1[56789]|2[012]))|[Nn][Ee][Xx][Tt]))$"
"pattern": "^([Ee][Ss]([356]|(20(1[56789]|2[0123]))|[Nn][Ee][Xx][Tt]))$"
}
],
"markdownDescription": "Set the JavaScript language version for emitted JavaScript and include compatible library declarations.\n\nSee more: https://www.typescriptlang.org/tsconfig#target"
Expand Down Expand Up @@ -988,6 +1004,18 @@
"default": false,
"markdownDescription": "Enable importing .json files\n\nSee more: https://www.typescriptlang.org/tsconfig#resolveJsonModule"
},
"resolvePackageJsonExports": {
"description": "Use the package.json 'exports' field when resolving package imports.",
"type": "boolean",
"default": false,
"markdownDescription": "Use the package.json 'exports' field when resolving package imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports"
},
"resolvePackageJsonImports": {
"description": "Use the package.json 'imports' field when resolving imports.",
"type": "boolean",
"default": false,
"markdownDescription": "Use the package.json 'imports' field when resolving imports.\n\nSee more: https://www.typescriptlang.org/tsconfig#resolvePackageJsonImports"
},
"assumeChangesOnlyAffectDirectDependencies": {
"description": "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it. Requires TypeScript version 3.8 or later.",
"type": "boolean"
Expand All @@ -1011,6 +1039,11 @@
"description": "Opt a project out of multi-project reference checking when editing.",
"type": "boolean",
"markdownDescription": "Opt a project out of multi-project reference checking when editing.\n\nSee more: https://www.typescriptlang.org/tsconfig#disableSolutionSearching"
},
"verbatimModuleSyntax": {
"description": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.",
"type": "boolean",
"markdownDescription": "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting.\n\nSee more: https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax"
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/test/jsconfig/jsconfig-typescript5.0.json
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"allowImportingTsExtensions": true,
"moduleResolution": "bundler",
"customConditions": "",
"target": "es2023",
"resolvePackageJsonExports": true,
"resolvePackageJsonImports": true,
"verbatimModuleSyntax": true
}
}
10 changes: 10 additions & 0 deletions src/test/package/exports-test7.json
@@ -0,0 +1,10 @@
{
"description": "conditions to paths",
"exports": {
"types": "./main-module.d.ts",
"import": "./main-module.js",
"require": "./main-require.cjs"
},
"name": "my-mod",
"type": "module"
}
12 changes: 12 additions & 0 deletions src/test/tsconfig/tsconfig-typescript5.0.json
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"allowArbitraryExtensions": true,
"allowImportingTsExtensions": true,
"moduleResolution": "bundler",
"customConditions": "",
"target": "es2023",
"resolvePackageJsonExports": true,
"resolvePackageJsonImports": true,
"verbatimModuleSyntax": true
}
}