feat(@schematics/angular): enable stricter type checking and optimization effective coding rules #17372
Conversation
IgorMinar
left a comment
There was a problem hiding this comment.
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!
| "noImplicitThis": true, | ||
| "noFallthroughCasesInSwitch": true, | ||
| "strictNullChecks": true,<% } %> | ||
| "strictPropertyInitialization": false,<% } %> |
There was a problem hiding this comment.
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.
Yeah that’s the reason.
I’ll also do a PR In AIO to remove that.
There was a problem hiding this comment.
So for AIO, we better do a followup task, as there a quite a lot of errors when I removed "strictPropertyInitialization": false
IgorMinar
left a comment
There was a problem hiding this comment.
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. |
IgorMinar
left a comment
There was a problem hiding this comment.
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
--strictoption.Changes in schematics
ng-new: A prompt for thestrictoption was added. This option is a proxy and will be passed to the application and workspace schematics.application: Apackage.jsonwas added in theappfolder, to tell the bundlers whether the application is free from side-effect code. Whenstrictistrue. thesideEffectswill be setfalse.workspaceWhenstrictis true, we add stricter TypeScript and Angular type-checking options.Note: AIO is already using these strict TypeScript compiler settings. PR to enable
strictTemplatesangular/angular#36391Reference: TOOL-1366