Change non-public [Parameter] warning severities to error.
- In preview8 we warned users for non-public `[Parameter]`s and `[Parameter]` setters. For preview9 this is now an error because things will not work as they expect. - Updated existing tests to reflect the new error expectation. #12294
This commit is contained in:
parent
45f9a2a44e
commit
d312d797fc
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Title), Resources.ResourceManager, typeof(Resources)),
|
new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Title), Resources.ResourceManager, typeof(Resources)),
|
||||||
new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Format), Resources.ResourceManager, typeof(Resources)),
|
new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Format), Resources.ResourceManager, typeof(Resources)),
|
||||||
"Encapsulation",
|
"Encapsulation",
|
||||||
DiagnosticSeverity.Warning,
|
DiagnosticSeverity.Error,
|
||||||
isEnabledByDefault: true,
|
isEnabledByDefault: true,
|
||||||
description: new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Description), Resources.ResourceManager, typeof(Resources)));
|
description: new LocalizableResourceString(nameof(Resources.ComponentParameterSettersShouldBePublic_Description), Resources.ResourceManager, typeof(Resources)));
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
new LocalizableResourceString(nameof(Resources.ComponentParameterShouldBePublic_Title), Resources.ResourceManager, typeof(Resources)),
|
new LocalizableResourceString(nameof(Resources.ComponentParameterShouldBePublic_Title), Resources.ResourceManager, typeof(Resources)),
|
||||||
new LocalizableResourceString(nameof(Resources.ComponentParameterShouldBePublic_Format), Resources.ResourceManager, typeof(Resources)),
|
new LocalizableResourceString(nameof(Resources.ComponentParameterShouldBePublic_Format), Resources.ResourceManager, typeof(Resources)),
|
||||||
"Encapsulation",
|
"Encapsulation",
|
||||||
DiagnosticSeverity.Warning,
|
DiagnosticSeverity.Error,
|
||||||
isEnabledByDefault: true,
|
isEnabledByDefault: true,
|
||||||
description: new LocalizableResourceString(nameof(Resources.ComponentParametersShouldBePublic_Description), Resources.ResourceManager, typeof(Resources)));
|
description: new LocalizableResourceString(nameof(Resources.ComponentParametersShouldBePublic_Description), Resources.ResourceManager, typeof(Resources)));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should have a public setter.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should have a public setter.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 7, 39)
|
new DiagnosticResultLocation("Test0.cs", 7, 39)
|
||||||
|
|
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should have a public setter.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should have a public setter.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 8, 39)
|
new DiagnosticResultLocation("Test0.cs", 8, 39)
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should have a public setter.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should have a public setter.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 9, 39)
|
new DiagnosticResultLocation("Test0.cs", 9, 39)
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.BadProperty1' should be public.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.BadProperty1' should be public.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 8, 40)
|
new DiagnosticResultLocation("Test0.cs", 8, 40)
|
||||||
|
|
@ -85,7 +85,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should have a public setter.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should have a public setter.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 8, 39)
|
new DiagnosticResultLocation("Test0.cs", 8, 39)
|
||||||
|
|
@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should have a public setter.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should have a public setter.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 9, 39)
|
new DiagnosticResultLocation("Test0.cs", 9, 39)
|
||||||
|
|
@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers.Test
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParameterSettersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should have a public setter.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should have a public setter.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 10, 39)
|
new DiagnosticResultLocation("Test0.cs", 10, 39)
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should be public.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty1' should be public.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 7, 32)
|
new DiagnosticResultLocation("Test0.cs", 7, 32)
|
||||||
|
|
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should be public.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty2' should be public.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 8, 40)
|
new DiagnosticResultLocation("Test0.cs", 8, 40)
|
||||||
|
|
@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should be public.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty3' should be public.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 9, 42)
|
new DiagnosticResultLocation("Test0.cs", 9, 42)
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Components.Analyzers
|
||||||
{
|
{
|
||||||
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
Id = DiagnosticDescriptors.ComponentParametersShouldBePublic.Id,
|
||||||
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty4' should be public.",
|
Message = "Component parameter 'ConsoleApplication1.TypeName.MyProperty4' should be public.",
|
||||||
Severity = DiagnosticSeverity.Warning,
|
Severity = DiagnosticSeverity.Error,
|
||||||
Locations = new[]
|
Locations = new[]
|
||||||
{
|
{
|
||||||
new DiagnosticResultLocation("Test0.cs", 10, 41)
|
new DiagnosticResultLocation("Test0.cs", 10, 41)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue