-
Notifications
You must be signed in to change notification settings - Fork 508
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 skipLibCheck, noEmit, consistentCasing, and lots of comments to template tsconfigs #864
Merged
agilgur5
merged 4 commits into
jaredpalmer:master
from
agilgur5:template-tsconfig-improvements
Sep 17, 2020
Merged
Add skipLibCheck, noEmit, consistentCasing, and lots of comments to template tsconfigs #864
agilgur5
merged 4 commits into
jaredpalmer:master
from
agilgur5:template-tsconfig-improvements
Sep 17, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- as defaults to the templates' tsconfigs - these are now recommended by TS to be set to true, which can be seen in the TSConfig Reference and @tsconfig/recommended - c.f. https://www.typescriptlang.org/tsconfig and https://www.npmjs.com/package/@tsconfig/recommended - also add to all fixtures - yea some centralization/extends or dogfooding create would help reduce all this duplication - skipLibCheck is a big perf gain, though it seems to only affect `tsc --noEmit` usage and rollup-plugin-typescript2 seems to ignore it - I have an existing issue open on the matter - forceConsistentCasingInFileNames is a no-brainer to help avoid a bug that is easy to make and hard to debug - also add a trailing comma for ease of use and better diffing - not to fixtures though, because there is a test for this
- for ease of use when using `tsc` for type-checking, which a lot of users already do - it doesn't fully type-check everything though, since we'd need to split off a tsconfig.build.json in order to let builds only run on `src` while type-checking would run on all files - but people already using `tsc --noEmit`, so might as well start supporting this as it's not uncommon - also add to all fixtures - yea some centralization/extends or dogfooding create would help reduce all this duplication
- since we can use comments in tsconfig.json, add them to give simple, one-liner explanations as to what each setting does - also add a link to the TSConfig Reference for further details - and specify which options are recommended as true by TS but not on by default for backwards compat or other reasons - a few leftover that I still need to think about
- the checks overlap with the @typescript-eslint/no-unused-vars rule - per user issue, this can result in duplicative errors inside an IDE, so explicitly call this out in a comment for `tsdx lint` / ESLint users in case they'd like to disable this and leave only one on - change the ordering of linter checks in the templates as well to make the comments easier to read/understand
This comment has been minimized.
This comment has been minimized.
agilgur5
added
the
scope: templates
Related to an init template, not necessarily to core (but could influence core)
label
Sep 17, 2020
agilgur5
commented
Sep 17, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 Diff was fairly straightforward to go through due to spacing between comments making it easier on the eyes
Failing CI check is another one of those GH Actions macOS timeouts, not an actual test failure. Should be good to go! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
scope: templates
Related to an init template, not necessarily to core (but could influence core)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Commits
feat: add skipLibCheck and forceConsistentCasingInFileNames
as defaults to the templates' tsconfigs
seen in the TSConfig Reference and @tsconfig/recommended
https://www.npmjs.com/package/@tsconfig/recommended
reduce all this duplication
skipLibCheck is a big perf gain, though it seems to only affect
tsc --noEmit
usage and rollup-plugin-typescript2 seems to ignore itforceConsistentCasingInFileNames is a no-brainer to help avoid a bug
that is easy to make and hard to debug
also add a trailing comma for ease of use and better diffing
feat: add noEmit to templates' tsconfigs
for ease of use when using
tsc
for type-checking, which a lot ofusers already do
split off a tsconfig.build.json in order to let builds only run on
src
while type-checking would run on all filestsc --noEmit
, so might as well startsupporting this as it's not uncommon
also add to all fixtures
reduce all this duplication
docs: add comments for nearly all tsconfig options in use
since we can use comments in tsconfig.json, add them to give simple,
one-liner explanations as to what each setting does
also add a link to the TSConfig Reference for further details
and specify which options are recommended as true by TS but not on by
default for backwards compat or other reasons
a few leftover that I still need to think about
docs: add comment that noUnused* overlaps with an ESLint rule
the checks overlap with the @typescript-eslint/no-unused-vars rule
per user issue, this can result in duplicative errors inside an IDE,
so explicitly call this out in a comment for
tsdx lint
/ ESLintusers in case they'd like to disable this and leave only one on
change the ordering of linter checks in the templates as well to make
the comments easier to read/understand
Tags
Fixes noEmit and skipLibCheck should be on by default in TS compiler options #529 as requested, since, per noEmit and skipLibCheck should be on by default in TS compiler options #529 (comment) these are now the defaults upstream as well
Fixes Redundant compiler options in template tsconfigs #619 , the second part about duplication with ESLint, by adding a comment as suggested in Redundant compiler options in template tsconfigs #619 (comment)
Comments and trailing comma are a result of tsdx silently fails parsing of tsconfig files containing comments, trailing commas, etc. that TSC accepts #483 / (fix): parse tsconfig extends, trailing commas, and comments #489 , since I didn't realize this was possible before
tsconfig
(but not quite all, and not including some forced or commented out options, i.e. Buffer got wrong value when "downlevelIteration":"true" in tsconfig.json #760 (comment))tsc --init
has comments too as existing precedentReview Notes
Key thing to check would be that all 3 templates and all 6 fixtures are similarly updated