---
title: "Retire components with a warning and a · Agent Wranglers"
url: https://agentwranglers.se/playbook/app-ui/styles-and-components/component-deprecation
id: APP-62
level: Recommended
updated: 2026-10-22
tokens: 914
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Retire components with a warning and a removal date

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Styles and components](https://agentwranglers.se/playbook/app-ui/styles-and-components.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: APP-62
- Level: Recommended
- Chapter: [Styles and components](https://agentwranglers.se/playbook/app-ui/styles-and-components.md)
- Rule: Mark each component you plan to remove as deprecated, with its replacement and a removal date. A lint rule flags every use, and the build fails once the date has passed while uses remain.
- Check: A test file that imports a deprecated component fails lint with a message that names the replacement. A script lists every deprecated component with its use count and removal date. No component with uses left is past its date.
- How: Removing a component without notice breaks every screen that uses it. Keep the deprecated component working and listed in the [catalogue](https://agentwranglers.se/playbook/app-ui/styles-and-components/component-catalogue.md) with its replacement named. Count the remaining uses each week and move them before the date, with a code rewrite script where many uses look alike. Remove it in the next major version. Web APIs retire the same way, as [Announce deprecation and sunset in headers](https://agentwranglers.se/playbook/api-design/changes-over-time/deprecation-headers.md) shows.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
// eslint.config.js
export default [{
  rules: {
    'no-restricted-imports': ['error', { paths: [
      { name: '@example/ui', importNames: ['OldDatePicker'], message: 'Deprecated, removed on 2027-03-01. Use DateField.' },
    ] }],
  },
}];
```

### Python example

```python
import datetime
import pathlib
import sys

DEPRECATED = {"OldDatePicker": ("DateField", datetime.date(2027, 3, 1))}

for name, (replacement, removal) in DEPRECATED.items():
    uses = [path for path in pathlib.Path("src").rglob("*.tsx") if name in path.read_text()]
    print(f"{name}: {len(uses)} uses, use {replacement}, removal {removal}")
    if uses and datetime.date.today() > removal:
        sys.exit(f"{name} is past its removal date with {len(uses)} uses left")
```

## Sources

- [Semantic Versioning 2.0.0 FAQ on deprecating functionality](https://semver.org/#how-should-i-handle-deprecating-functionality)

## Related rules

- APP-5 [Show every component state in a catalogue](https://agentwranglers.se/playbook/app-ui/styles-and-components/component-catalogue.md) in Web app interface
- API-29 [Announce deprecation and sunset in headers](https://agentwranglers.se/playbook/api-design/changes-over-time/deprecation-headers.md) in API design

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/app-ui/styles-and-components/component-deprecation">Agent Wranglers web app interface playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Give the component library an owner and version numbers](https://agentwranglers.se/playbook/app-ui/styles-and-components/component-library-ownership.md)
- [Styles and components](https://agentwranglers.se/playbook/app-ui/styles-and-components.md)
