Add option to enable existing project strict mode
See original GitHub issueπ Feature request
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- [ x] update
- lint
- xi18n
- run
- config
- help
- version
- doc
Description
This doc: https://angular.io/guide/strict-mode shows how to create a project with strict mode, but donβt show how to enable strict mode in existing project
Describe the solution youβd like
- Add in the docs more information about changing the strictness mode for existing projects
- Add option to the Angular CLI to enable strict mode in existing projects
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Angular 10 Stricter Settings --strict
Is there a command line that will upgrade an existing project to strict mode, or I just need to create a new project...
Read more >Strict mode
Angular CLI creates all new workspaces and projects with strict mode enabled. Strict mode improves maintainability and helps you catch bugs ahead of...
Read more >Strict mode - Angular Hispano
When you create a new workspace or a project you have an option to create them in a strict mode using the --strict...
Read more >Angular 10βStrict mode
There is no out-of-the box option to enable this for an existing project(after creating it without the βstrict flag or after upgrading from...
Read more >Be proactive when you join an Angular project
Enable strict mode ... The first time when you enable one or both strict options you are probably going to see some errors...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Currently
ng new --strict
is mostly a test for the news features. Eventually we want to βgraduateβ some of the changes to being included by default and also apply them to existing projects. To do that, weβll need a migration eventually, so we may as well do it sooner than later and make it available as an optional migration for those who choose to opt-in early.Since these flags increase strictness, they will likely cause compile errors on an existing code base. This is probably expected and manageable for users who want to opt-in. We may want to opt-out any existing offenders from the change where we can. For instance, we can enable the
no-any
TSLint check, but then add// tslint:disable-next-line:no-any
for all existing uses ofany
. This could also include a TODO to fix it. This would be useful to ignore existing offenses while still tracking them and allowing users to take advantage of the new strictness. Ideally we could do this with all the breaking changes, but that may not be possible, so weβll need to evaluate the practicality of such changes (TypeScriptβsstrict
flag in particular would be extremely difficult to do this for).As a workaround for the time being, the guide does list all the changes comprehensively, though they arenβt very well explained about what the exact source code changes are and the complete effects of it. I also gave a talk just the other day which goes through all the changes and in particular explains the side effects change that is probably the most complex and least helpfully documented for this use case. If you want to enable strict mode today, you can basically just add those flags and then fix whatever compile errors occur from them. When we get a future optional migration, this process will be a little bit easier.
Hi @Splaktar Opened: https://github.com/angular/angular/issues/38771