Linting before the first PR

All projects MUST have linting configured and passing before the first pull request. Linting config SHOULD be set up early in the project, but during rapid prototyping, committing without lint-gating every commit is acceptable. Before any PR is opened, lint MUST be clean.

Platform Linter Formatter
Swift SwiftLint swift-format
Kotlin ktlint ktlint
TypeScript ESLint Prettier
C# / .NET Roslyn Analyzers + .editorconfig dotnet format

Linter config MUST be committed. Linting MUST run as part of the build or pre-commit process. Formatting MUST be auto-fixable.

Swift

  1. SwiftLint with .swiftlint.yml at project root. Enable strict mode. Add as SPM plugin or Xcode build phase.
  2. swift-format for auto-formatting.

Kotlin

Use ktlint for both linting and formatting. Configure via .editorconfig at project root. Add as a Gradle plugin (org.jlleitschuh.gradle.ktlint).

TypeScript

  1. ESLint with eslint.config.js. Use eslint-config-prettier to avoid conflicts with the formatter.
  2. Prettier with .prettierrc for auto-formatting.
  3. Stylelint with .stylelintrc.json for CSS linting.
  4. Add as package.json scripts and pre-commit hooks.

C#

  1. .editorconfig at repo root for all code style rules.
  2. Enable Roslyn analyzers in .csproj:
<PropertyGroup>
  <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
  <AnalysisLevel>latest-recommended</AnalysisLevel>
</PropertyGroup>
  1. Use dotnet format CLI for auto-fixing.
  2. Supplement with Roslynator or Meziantou.Analyzer for additional rules.
version
1.1.0
platforms
csharp, kotlin, swift, typescript, web
tags
code-quality, linting
author
Mike Fullerton
modified
2026-04-09

Change History

Version Date Author Summary
1.1.0 2026-04-09 Mike Fullerton Soften timing to "before the first PR", add triggers
1.0.0 2026-03-27 Mike Fullerton Initial creation