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

[typescript] continue to use the default config in development #21966

Merged
merged 3 commits into from
Aug 14, 2018

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Aug 14, 2018

In #21865 we tried to make a separate config file that would be used for browser TS files by excluding them from the default config file and adding a second that included them. This works fine in the build, but IDE integrations rely on being able to automatically discover a tsconfig.json file in a parent directory of the file being edited, which doesn't work when the tsconfig.json file is found, but excludes the file being edited. In this situation IDE integrations silently fallback to the default TSConfig settings, which don't show the types of compiler errors that will become issues in CI, like implicit any warnings.

This implements the original strategy we tried in #21865 of mutating the tsconfig.json file before we run the tsc in the build so that the config files select the right files at build time.

In elastic#21865 we tried to make a separate config file that would be used for
browser TS files by excluding them from the default config file and
adding a second that included them. This works fine in the build, but
IDE integrations rely on being able to automatically discover a
`tsconfig.json` file in a parent directory of the file being edited,
which doesn't work when the tsconfig.json file is found, but excludes
the file being edited. In this situation IDE integrations silently
fallback to the default TSConfig settings, which don't show the types of
compiler errors that will become issues in CI, like implicit any
warnings.

This implements the original strategy we tried in elastic#21865 of mutating the
tsconfig.json file before we run the tsc in the build so that the config
files select the right files at build time.
@spalger spalger added review Team:Operations Team label for Operations Team v7.0.0 v6.5.0 labels Aug 14, 2018
@spalger spalger requested a review from jbudz August 14, 2018 18:27
@@ -5,7 +5,10 @@
"module": "esnext",
},
"include": [
"src/**/public/**/*"
// in the build we populate this to include **/public/**/* but
Copy link
Member

Choose a reason for hiding this comment

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

is the config loader okay with comments in json? i don't think this will lint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, typescript config can have comments, checkout tsconfig.json. It has a bunch of them and always has.

await write(browserProject.tsConfigPath, JSON.stringify({
...browserProject.config,
include: [
...browserProject.config.exclude,
Copy link
Member

Choose a reason for hiding this comment

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

include config.exclude?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, copy paste fumble

Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

Tested both browser and server code in VS Code, LGTM. I'll let CI handle the build testing.

@spalger
Copy link
Contributor Author

spalger commented Aug 14, 2018

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elastic elastic deleted a comment from elasticmachine Aug 14, 2018
@spalger spalger merged commit 5db7245 into elastic:master Aug 14, 2018
spalger pushed a commit to spalger/kibana that referenced this pull request Aug 14, 2018
…ic#21966)

* [typescript] continue to use the default config in development

In elastic#21865 we tried to make a separate config file that would be used for
browser TS files by excluding them from the default config file and
adding a second that included them. This works fine in the build, but
IDE integrations rely on being able to automatically discover a
`tsconfig.json` file in a parent directory of the file being edited,
which doesn't work when the tsconfig.json file is found, but excludes
the file being edited. In this situation IDE integrations silently
fallback to the default TSConfig settings, which don't show the types of
compiler errors that will become issues in CI, like implicit any
warnings.

This implements the original strategy we tried in elastic#21865 of mutating the
tsconfig.json file before we run the tsc in the build so that the config
files select the right files at build time.

* [tslint] remove browser config from default projects list since it is empty

* [build/ts] fix typo
@elasticmachine
Copy link
Contributor

💔 Build Failed

spalger pushed a commit that referenced this pull request Aug 15, 2018
… (#21973)

* [typescript] continue to use the default config in development

In #21865 we tried to make a separate config file that would be used for
browser TS files by excluding them from the default config file and
adding a second that included them. This works fine in the build, but
IDE integrations rely on being able to automatically discover a
`tsconfig.json` file in a parent directory of the file being edited,
which doesn't work when the tsconfig.json file is found, but excludes
the file being edited. In this situation IDE integrations silently
fallback to the default TSConfig settings, which don't show the types of
compiler errors that will become issues in CI, like implicit any
warnings.

This implements the original strategy we tried in #21865 of mutating the
tsconfig.json file before we run the tsc in the build so that the config
files select the right files at build time.

* [tslint] remove browser config from default projects list since it is empty

* [build/ts] fix typo
@spalger
Copy link
Contributor Author

spalger commented Aug 15, 2018

6.x/6.5: ad3e193

@spalger spalger deleted the fix/browser-ts-ide-integration branch August 15, 2018 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review Team:Operations Team label for Operations Team v6.5.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants