question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:20
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
dgp1130commented, Jul 16, 2020

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 of any. 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’s strict 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.

1reaction
saifabusalehcommented, Sep 9, 2020

This is currently 2 issues in one (migration which is assigned to the engineering team, and docs which would be assigned to the docs team). This makes it hard to track these two issues.

@saifabusaleh can you please find/open a separate issue in angular/angular for the docs part of this and link it to this issue?

Hi @Splaktar Opened: https://github.com/angular/angular/issues/38771

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found