Issue
The kebab-case analyzer should have an exception for Razor component files (.razor) as they must be PascalCase.
Background
When Razor components are compiled, they become C# classes with the class name derived from the filename. For example:
_Imports.razor becomes the _Imports class
Counter.razor becomes the Counter class
MainLayout.razor becomes the MainLayout class
Using kebab-case for these files (like _imports.razor or main-layout.razor) causes compilation errors because:
- The generated class names would be invalid C# identifiers
- References to these components in code expect PascalCase names
Discovered During
This was discovered during the kebab-case migration of the timewarp-state project where renaming _imports.razor to lowercase caused build failures with errors like:
error CS0234: The type or namespace name '_Imports' does not exist in the namespace
Related Issue
This is related to the .NET issue: dotnet/razor#12131 which discusses Razor component naming requirements.
Recommendation
The analyzer should:
- Exclude all .razor files from kebab-case requirements
- Optionally enforce PascalCase for .razor files to match C# naming conventions
Issue
The kebab-case analyzer should have an exception for Razor component files (.razor) as they must be PascalCase.
Background
When Razor components are compiled, they become C# classes with the class name derived from the filename. For example:
_Imports.razorbecomes the_ImportsclassCounter.razorbecomes theCounterclassMainLayout.razorbecomes theMainLayoutclassUsing kebab-case for these files (like
_imports.razorormain-layout.razor) causes compilation errors because:Discovered During
This was discovered during the kebab-case migration of the timewarp-state project where renaming
_imports.razorto lowercase caused build failures with errors like:Related Issue
This is related to the .NET issue: dotnet/razor#12131 which discusses Razor component naming requirements.
Recommendation
The analyzer should: