requireDeprecationDate
| Property | Value |
|---|---|
| Config name | requireDeprecationDate |
| Default severity | — |
| Context | Schema |
| In recommended | No |
What it checks
Section titled “What it checks”Requires @deprecated directives to include a deletion date in the reason string. This helps teams track when deprecated fields, arguments, and enum values should be removed by requiring a date pattern like deletionDate: 01/01/2025 in the deprecation reason.
The rule checks:
- Fields on object and interface types
- Field arguments
- Enum values
It looks for the configured argument name (default deletionDate) followed by : or = and a non-empty value in the reason string.
Examples
Section titled “Examples”# ❌ Bad — @deprecated without a deletion datetype User { id: ID! oldField: String @deprecated(reason: "Use newField instead")}# ❌ Bad — @deprecated with no reason at alltype User { id: ID! oldField: String @deprecated}# ✅ Good — @deprecated with a deletion datetype User { id: ID! oldField: String @deprecated(reason: "Use newField instead, deletionDate: 01/01/2025")}# ✅ Good — also works with = separatortype User { id: ID! oldField: String @deprecated(reason: "Use newField, deletionDate = 2025-01-01")}# ❌ Bad — enum value deprecated without a deletion dateenum Status { ACTIVE LEGACY @deprecated(reason: "No longer used")}# ✅ Good — enum value with a deletion dateenum Status { ACTIVE LEGACY @deprecated(reason: "No longer used, deletionDate: 2025-06-01")}Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
argumentName | string | "deletionDate" | The key to look for in the deprecation reason string |
Configuration
Section titled “Configuration”# Enable with default argument name (deletionDate)extensions: graphql-analyzer: lint: rules: requireDeprecationDate: warn
# Use a custom argument nameextensions: graphql-analyzer: lint: rules: requireDeprecationDate: [warn, { argumentName: "removalDate" }]
# Object styleextensions: graphql-analyzer: lint: rules: requireDeprecationDate: severity: warn options: argumentName: "removalDate"