In Angular 10 you can create a new project using ng new --strict
Enabling this flag initializes your new project with a few new
settings that improve maintainability, help you catch bugs ahead of
time, and allow the CLI to perform advanced optimizations on your app
Is there a command line that will upgrade an existing project to strict mode, or I just need to create a new project and then copy-paste the files from the other project?
Best Solution
Basically a couple things change:
tsconfig.base.json
gets some new rules:tslint.json
gets updatedangular.json
:and a schematics addition to your
projects.[projectName].schematics
path in theangular.json
:package.json
gets updated with asideEffects
property:For an explanation what this does, I can refer you to this answer.
This
package.json
is located inside your app folder. It should be added there with the migration while using theng update
option. If you do not have this file, you can use this templateTo convert a current codebase, especially the tsconfig updates and the
no-any
will give you some headache to fix. But it will be definitely worth it to get a better (less hidden bugs) and easier to refactor codebase.