Is your feature request related to a problem? Please describe.
Currently, the AvaloniaXKCD repository lacks an automated process for code linting and formatting. This can lead to inconsistent coding styles, reduced code quality, and potential bugs that are not caught early in the development process. A consistent and clean codebase is easier to read, maintain, and contribute to.
Describe the solution you'd like
To improve code quality and maintain a consistent style across the project, we propose integrating linting and formatting tools into the build pipeline for both the C# and TypeScript code.
For C#:
- CSharpier: An opinionated code formatter for C#, inspired by Prettier. Its "format on save" feature and minimal configuration can help enforce a uniform style with little overhead.
- dotnet format: The official .NET code formatter that can apply style preferences from an
.editorconfig file. It also includes capabilities for code style analysis.
Recommendation: Use CSharpier for consistent, opinionated formatting and supplement with dotnet format for its analytical and linting capabilities.
For TypeScript/JavaScript:
- ESLint: A pluggable linting utility for JavaScript and TypeScript that identifies problematic patterns in the code. It helps enforce best practices and catch bugs.
- Prettier: An opinionated code formatter that focuses solely on code style and formatting.
Recommendation: Use both Prettier for formatting and ESLint for code quality and bug detection, as this is a common and recommended practice. They can be configured to work together to prevent conflicts.
Describe alternatives you've considered
- Manual Formatting. buthis is the current process and is not scalable or consistent, especially as more contributors get involved.
- Using only
dotnet format for C, but while dotnet format is a capable tool, CSharpier's opinionated nature can simplify setup and prevent debates over style rules.
- Using only ESLint for TypeScript. ESLint can be configured for formatting, but Prettier is generally faster and more specialized for that task.
Additional context
Acceptance Criteria:
Is your feature request related to a problem? Please describe.
Currently, the AvaloniaXKCD repository lacks an automated process for code linting and formatting. This can lead to inconsistent coding styles, reduced code quality, and potential bugs that are not caught early in the development process. A consistent and clean codebase is easier to read, maintain, and contribute to.
Describe the solution you'd like
To improve code quality and maintain a consistent style across the project, we propose integrating linting and formatting tools into the build pipeline for both the C# and TypeScript code.
For C#:
.editorconfigfile. It also includes capabilities for code style analysis.Recommendation: Use CSharpier for consistent, opinionated formatting and supplement with dotnet format for its analytical and linting capabilities.
For TypeScript/JavaScript:
Recommendation: Use both Prettier for formatting and ESLint for code quality and bug detection, as this is a common and recommended practice. They can be configured to work together to prevent conflicts.
Describe alternatives you've considered
dotnet formatfor C, but whiledotnet formatis a capable tool, CSharpier's opinionated nature can simplify setup and prevent debates over style rules.Additional context
Acceptance Criteria: