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

Enable "strict" compiler option #2352

Merged
merged 5 commits into from
Apr 19, 2023

Conversation

cristiano-belloni
Copy link
Contributor

@cristiano-belloni cristiano-belloni commented Apr 18, 2023

  • Enable strict
  • Support falsy values in configuration
  • Slightly better typing

@changeset-bot
Copy link

changeset-bot bot commented Apr 18, 2023

🦋 Changeset detected

Latest commit: 4761d53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
modular-scripts Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls
Copy link
Collaborator

Coverage Status

Coverage: 43.895%. Remained the same when pulling 4761d53 on feature/allow-strict-compilerOption into bdae623 on feature/v4.4.

@cristiano-belloni cristiano-belloni marked this pull request as ready for review April 19, 2023 12:15
@@ -55,7 +61,7 @@ function restrictUserTsconfig(

// Where the user has defined allowlist-supported compiler options, apply them
for (const item of COMPILER_OPTIONS_ALLOW_LIST) {
if (compilerOptions && compilerOptions[item]) {
if (compilerOptions?.[item] !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I get that this is needed to allow false, but by explicitly checking for !== undefined I think you might be technically allowing something like null. Saying that, it's probably OK to consider that something end users should fix though, rather than validating values here or anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sgb-io I guess if we end up with null there, it means that the user explicitly (and probably erroneously) ended up with a null option in their configuration. I think we should let tsconfig validate and eventually throw in that case, instead of ignoring the option, because it could be a symptom of something wrong (i.e. buggy conf script / json from the user). undefined is a special case, because unfortunately it means both "absence of key" and "key was set to undefined" in Javascript, and there's no way of distinguishing that if the conf comes from outside.

@cristiano-belloni cristiano-belloni merged commit ccffbfd into feature/v4.4 Apr 19, 2023
@cristiano-belloni cristiano-belloni deleted the feature/allow-strict-compilerOption branch April 19, 2023 13:42
@github-actions github-actions bot mentioned this pull request May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants