Closed petamoriken closed 1 month ago
There are 3 aspects I think are important to consider. In the table below,
deno check --all
is used).Recommended | Independent | Has quick fix | |
---|---|---|---|
exactOptionalPropertyTypes |
✓ | ✓ | |
noImplicitOverride |
✓ | ✓ | |
noUncheckedIndexedAccess |
✓ | ||
useUnknownInCatchVariables |
✓ | ✓ |
I am in favor of enabling useUnknownInCatchVariables
. I am also ok with enabling noImplicitOverride
.
For exactOptionalPropertyTypes
, we'd have to do some experimentation to see if it would be very breaking (for example checking std
, fresh
, some projects using fresh, lume
, etc).
For noUncheckedIndexedAccess
, I do not think we should enable it by default. The option is very prone to false positives unfortunately.
I would suggest turning on all TypeScript checking options to the max. The only thing holding me back from using Deno right now is that the TypeScript checking is so poorly configured.
I opened #25465 for useUnknownInCatchVariables.
For exactOptionalPropertyTypes and noUncheckedIndexedAccess I think it would be too breaking. For noImplicitOverride, I'm trying to figure out why TypeScript doesn't have this in the default "strict"
options.
For exactOptionalPropertyTypes and noUncheckedIndexedAccess I think it would be too breaking.
Unfortunately I agree that "exactOptionalPropertyTypes"
and "noUncheckedIndexedAccess"
have too much impact on existing projects. How about enabling these options in new code by enabling them in deno init
?
For exactOptionalPropertyTypes and noUncheckedIndexedAccess I think it would be too breaking.
@dsherret What's wrong with making a breaking change at a new major version which encourages writing safer code? That seems like exactly the right time to me… and users can always modify their compiler options to suppress these safer checks. The alternative currently appears to me as "we can never enable safer type checking by default because people have already written less safe code and we don't want them to feel the need to make changes as part of a major version upgrade."
or, is there any easy way to let me enable configs via https://github.com/tsconfig/bases?
I would also like to include noImplicitReturns
in this suggestion list — since it's not already enabled (📌)
It is possible to request to disable the options in compilerOptions for those who think the default settings are too strict in the release article, so I think it is better to make it as strict as possible. Especially for options that require type info that cannot be handled by deno_lint.
I think noImplicitReturns
should probably be duplicated in a lint rule and enabled by default.
I think
noImplicitReturns
should probably be duplicated in a lint rule and enabled by default.
It certainly seems so. This option need not be enabled by default, as it does not use any type information in particular. https://lint.deno.land/rules/explicit-function-return-type
Apparently it has been decided that "exactOptionalPropertyTypes"
and "noUncheckedIndexedAccess"
will not be enabled by default, so close this issue.
I have reconsidered that this issue should be closed after https://github.com/denoland/deno/issues/11889#issuecomment-2359386226 has been resolved.
I would like to enable the following options by default in Deno v2:
"noUncheckedIndexedAccess"
Any thoughts?