Deprecation Strategy

Deprecation Cycle

Packages in the Core repository try to adhere to a one full major version deprecation cycle.

For example, if something is deprecated in version

, then it should not be removed until version
. However, if someone was deprecated with a major version release, that thing can be safely removed in the next major version release. For example, deprecating an item in the
release, it can be safely removed when
is released.

From Deprecation Notice to the Migration Guide

Whenever an item in the library is deprecated, the deprecation notes will include information on how to transition away from the item being deprecated. Eventually these notes become the migration guide when the deprecation becomes a decommission in a major version release.

The information is sourced from the JSDoc

and
tags. The deprecation text should include some basic description of why the change and a
and
code sample block.

For situations where we don't have something to migrate to, we should be very careful to validate with the UI Foundations team that deprecating is the right strategy.

Dual support

There are times when a component needs to be drastically changed, but we don't want to introduce breaking changes just yet. An example of this has been

in the library.

For situations like this, we recommend prefixing the "new" component that is being built with the

prefix, e.g.
. This allows continued development of similar new components while avoiding the necessity to do a breaking version change in the library.

The old component that is being superseded should be marked as

, with a migration guide to use the new,
component.

During the next major version release we would delete the deprecated component and drop

from the new component.

Documenting Deprecations

Annotating components for deprecation

The

tag includes the message that goes along with the deprecation, along with a simple
and
example code block.

The

tag should list the current version of the library when the deprecation occurs. This will allow us to more easily adhere to the two version deprecation lifecycle.

Deprecating components

To deprecate a component, the component export should be annotated with a JSDoc comment including the

and
tags.

e.g. if we are deprecating the

component, it would look like so:

Deprecating props

To deprecate a prop on a component, the types should be updated to be annotated with a JSDOC comment included the

tag and the
tags.

Deprecating parts of union types

It is not currently possible to deprecate individual parts of a union type using inline JSDoc comments.

In this case, while the comment is attached to 'sm', it will not enforce any deprecation warnings or alter behavior for string literals. The only viable approach is to include a general deprecation note on the entire union type rather than on individual values.

Depending on the impact of false postives, we may opt to not deprecate with

and instead manually add the deprecation to the list.

Deprecation Steps Specific To Libraries

core-react

Core-React's

re-export requires specific locations of JSDocs comments. It also requires
on the subcomponents themself, and duplicating subcomponent notes.

Finally we need to make sure the typedoc can import them.

core-i18n-js

library is essentially a fork of https://github.com/fnando/i18n-js. We have diverged from the upstream slightly, and generally this library should not be touched or have things deprecated.

core-icons

are updated in by an automation via a script, it handles breaking changes correctly but there is no current way to deprecate.

data-table

component should follow the same rules as

ui-service-utils

library should follow the same rules as