-
Notifications
You must be signed in to change notification settings - Fork 12k
feat(@schematics/angular): enable stricter type checking and optimization effective coding rules #17372
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
Conversation
packages/schematics/angular/workspace/files/tsconfig.json.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/other-files/package.json.template
Show resolved
Hide resolved
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.
other than the nits I posted, this looks good overall.
Please resolve the comments.
@kyliau can you please add these changes to the list of changes we'll want the Docs and DevRel team to carefully review - I'd like them to review all changes to "strings" that are displayed to the user either as prompts, config file / schema comments/docs, or comments in generated files that end up in user workspace. thanks!
packages/schematics/angular/application/other-files/package.json.template
Outdated
Show resolved
Hide resolved
packages/schematics/angular/application/other-files/package.json.template
Show resolved
Hide resolved
"noFallthroughCasesInSwitch": true, | ||
"strictNullChecks": true,<% } %> | ||
"strictPropertyInitialization": false,<% } %> |
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.
why? Is this because of @components with @inputs?
I do think that developer's should provide a default value. That's what I do and it works quite well.
I recommend removing this line.
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.
Yeah that’s the reason.
I’ll also do a PR In AIO to remove that.
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.
So for AIO, we better do a followup task, as there a quite a lot of errors when I removed "strictPropertyInitialization": false
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.
oh.. @alan-agius4 one more thing.. weren't we supposed to decrease the budget limits in the --strict
mode as well? was that skipped intentionally? Is that in a separate PR? thanks
@IgorMinar, yes I skipped that intentionally as I wanted to follow up with a couple of other PRs to address the bundle budgets and module target. |
@alan-agius4 ok. Sgtm |
@IgorMinar, FYI I actually pushed the budget change in the PR. |
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.
Almost there!
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.
looks great now! let's get this puppy in! thank you!
@alan-agius4, looks like this was the unlucky one again that hit a merge conflict today. |
…tion effective coding rules With this change we enable stricter type checking and optimization effective coding rules when using the `--strict` option. Changes in schematics - `ng-new`: A prompt for the `--strict` option was added. This option is a proxy and will be passed to the application and workspace schematics. - `application`: A `package.json` was added in the `app` folder, to tell the bundlers whether the application is free from side-effect code. When `strict` is `true`. the `sideEffects` will be set `false`. - `workspace` When `strict` is true, we add stricter TypeScript and Angular type-checking options. Note: AIO is already using these strict TypeScript compiler settings. PR to enable `strictTemplates` angular/angular#36391 Reference: TOOL-1366
… `--strict` option When using the strict option `anyComponentStyle` and `initial` budgets are more strict.
@dgp1130, conflict solved. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
With this change we enable stricter type checking and optimization effective coding rules when using the
--strict
option.Changes in schematics
ng-new
: A prompt for thestrict
option was added. This option is a proxy and will be passed to the application and workspace schematics.application
: Apackage.json
was added in theapp
folder, to tell the bundlers whether the application is free from side-effect code. Whenstrict
istrue
. thesideEffects
will be setfalse
.workspace
Whenstrict
is true, we add stricter TypeScript and Angular type-checking options.Note: AIO is already using these strict TypeScript compiler settings. PR to enable
strictTemplates
angular/angular#36391Reference: TOOL-1366