Drupal 8: remove module configuration on uninstall

The easiest way is to ensure that the config has a dependency on your module.

dependencies:
  enforced:
    module:
      - yourmodule

Then Drupal will automatically remove that configuration and also warn in the UI that it will be removed.

Tags: