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

Add link to documentation in tsconfig.json template generated by tsc --init #34686

Merged
merged 11 commits into from
Mar 30, 2020

Conversation

borgfriend
Copy link
Contributor

Fixes #34538

@RyanCavanaugh
Copy link
Member

A PR adding the link to the top is OK, but again, we do not want literally every compiler flag listed in the init tsconfig. For example, some of the flags listed here do nothing, are explicitly discouraged, or have dangerous effects.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Oct 24, 2019

Reopening in case you want to just make the PR about providing the link to other options. In that case, I would also suggest we remove the emitted comment descriptions because they tend to be a major pain when using tsc --init.

@borgfriend
Copy link
Contributor Author

I removed the Advanced Options again... however I would suggest to move various options then into better category names like "Deprecated", "Use with Caution" etc.

Me not being really familiar with the codebase just assumed these are all "Advanced options" that you should be able to use as an advanced user.

In addition I removed the comment descriptions as you suggested.

@sandersn sandersn added the For Backlog Bug PRs that fix a backlog bug label Feb 3, 2020
@sandersn
Copy link
Member

sandersn commented Mar 9, 2020

@borgfriend Can you update the description of this PR? I'm triaging our old PRs that we forgot about and I can't tell what this evolved into, but it seems different than the initial description.

@borgfriend borgfriend changed the title Add Advanced Compile Options to --init command Add link to documentation in tsconfig.json template generated by tsc --init Mar 10, 2020
@borgfriend
Copy link
Contributor Author

borgfriend commented Mar 10, 2020

I think it is quite misleading to only expose a subset of flags available in tsconfig.json when generating it via tsc --init.

The current flags are "handpicked" because - there are dangerous, deprecated flags that should not be exposed.

The issue evolved into:

  • add link on top of generated tsconfig.json to documentation
  • remove the emitted comment descriptions (as suggested by @DanielRosenwasser)

Thus users would be encouraged to take a look at the documentation to learn more about available flags (also those that are not available in the 'handpicked selection')

@sheetalkamat
Copy link
Member

@borgfriend can you please update this to resolve merge conflicts.. Thanks

@orta
Copy link
Contributor

orta commented Mar 13, 2020

There's an example of what we'd like it to look like in #37361 (comment) too

@borgfriend
Copy link
Contributor Author

@sheetalkamat I fixed the merge conflicts, @orta adjusted the link to be like in the example

@@ -150,6 +150,14 @@ namespace ts {
category: Diagnostics.Command_line_Options,
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
},
{
Copy link
Member

Choose a reason for hiding this comment

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

There is already incremental included in this list why is there another entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

guess that was automerged and I missed it - pushed a fix for it

Copy link
Member

Choose a reason for hiding this comment

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

Can you please existing entry instead? Is there reason this needs to move ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

better now?

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
Copy link
Member

Choose a reason for hiding this comment

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

Example shows the comments as not removed #37361 (comment) @RyanCavanaugh @DanielRosenwasser Whats the final call on that

@@ -2108,10 +2108,9 @@ namespace ts {

function isAllowedOption({ category, name }: CommandLineOption): boolean {
// Skip options which do not have a category or have category `Command_line_Options`
// Exclude all possible `Advanced_Options` in tsconfig.json which were NOT defined in command line
Copy link
Member

Choose a reason for hiding this comment

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

Return the comment, remove the extra ;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

The comment is still gone. Can you please fix that so that its ready to merge

// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "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. */
/* Basic Options */ /* Enable incremental compilation */
Copy link
Member

Choose a reason for hiding this comment

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

The comments are off by a line ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is rather odd, i just reverted my change of removing them.
I adjusted the code so an offset is not possible anymore

@borgfriend
Copy link
Contributor Author

I just noticed that for the flag "target" the description states the default is 'es3' - however it is set to 'es5'?

Maybe the target and description should be updated to ES2017 (version supported by node 8, and all current Browsers without IE)?

Should I change the flag?

@sheetalkamat
Copy link
Member

@borgfriend default for target is es3 (that means if target is not specified it is es3). The comment is correct

@sheetalkamat sheetalkamat merged commit 9cd4b07 into microsoft:master Mar 30, 2020
@System233 System233 mentioned this pull request Oct 13, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add Advanced Compiler flags in tsconfig.json generated by --init
6 participants