Skip to content

Commit dfef9ab

Browse files
committed
Add a diagnostic ID for asp-for attribute deprecation
1 parent 56fae38 commit dfef9ab

File tree

6 files changed

+11
-5
lines changed

6 files changed

+11
-5
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace GovUk.Frontend.AspNetCore;
2+
3+
internal static class DiagnosticIds
4+
{
5+
public const string UseForAttributeInstead = "GFA0001";
6+
}

src/GovUk.Frontend.AspNetCore/TagHelpers/CharacterCountTagHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ internal CharacterCountTagHelper(IComponentGenerator componentGenerator, IModelH
6868
/// An expression to be evaluated against the current model.
6969
/// </summary>
7070
[HtmlAttributeName(AspForAttributeName)]
71-
[Obsolete("Use the 'for' attribute instead.")]
71+
[Obsolete("Use the 'for' attribute instead.", DiagnosticId = DiagnosticIds.UseForAttributeInstead)]
7272
public ModelExpression? AspFor
7373
{
7474
get => For;

src/GovUk.Frontend.AspNetCore/TagHelpers/ErrorMessageTagHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal ErrorMessageTagHelper(
4848
/// An expression to be evaluated against the current model.
4949
/// </summary>
5050
[HtmlAttributeName(AspForAttributeName)]
51-
[Obsolete("Use the 'for' attribute instead.")]
51+
[Obsolete("Use the 'for' attribute instead.", DiagnosticId = DiagnosticIds.UseForAttributeInstead)]
5252
public ModelExpression? AspFor
5353
{
5454
get => For;

src/GovUk.Frontend.AspNetCore/TagHelpers/ErrorSummaryItemTagHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal ErrorSummaryItemTagHelper(
5454
/// An expression to be evaluated against the current model.
5555
/// </summary>
5656
[HtmlAttributeName(AspForAttributeName)]
57-
[Obsolete("Use the 'for' attribute instead.")]
57+
[Obsolete("Use the 'for' attribute instead.", DiagnosticId = DiagnosticIds.UseForAttributeInstead)]
5858
public ModelExpression? AspFor
5959
{
6060
get => For;

src/GovUk.Frontend.AspNetCore/TagHelpers/FormGroupTagHelperBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ private protected FormGroupTagHelperBase(
3333
/// An expression to be evaluated against the current model.
3434
/// </summary>
3535
[HtmlAttributeName(AspForAttributeName)]
36-
[Obsolete("Use the 'for' attribute instead.")]
36+
[Obsolete("Use the 'for' attribute instead.", DiagnosticId = DiagnosticIds.UseForAttributeInstead)]
3737
public ModelExpression? AspFor
3838
{
3939
get => For;

src/GovUk.Frontend.AspNetCore/TagHelpers/TextInputTagHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ internal TextInputTagHelper(IComponentGenerator componentGenerator, IModelHelper
8080
/// An expression to be evaluated against the current model.
8181
/// </summary>
8282
[HtmlAttributeName(AspForAttributeName)]
83-
[Obsolete("Use the 'for' attribute instead.")]
83+
[Obsolete("Use the 'for' attribute instead.", DiagnosticId = DiagnosticIds.UseForAttributeInstead)]
8484
public ModelExpression? AspFor
8585
{
8686
get => For;

0 commit comments

Comments
 (0)