An opinionated set of files and configurations usefull to enforce coding best practices and uniformity in ASP.NET 6 projects
This repository assumes that there are two "levels"
- Root folder → the root directory containing all the projects of the solution
- WebSite folder → a folder containing an hypotetical ASP.NET 6 web application, inheriting and extending the settings contained into the Root folder
Just copy all the files into the root of your target solution and/or related subfolders as needed (if and when an override/extension is required).
If your root already contains one or more of these file, you will need to merge them manually.
This folder represents the root directory containing all the projects of the solution, and contains the following files:
- Directory.Build.props → This is the backbone gluing together the other configuration files. It defines the basic NuGet dependencies (and the related configuration files) applied to all the projects in the root folder and its subfolders.
- .editorconfig → Define an opinionated set of global rules applied to the editor and enforced into the build process via the Roslyn Analyzers referenced by Directory.Build.props:
- Lindhart.Analyser.MissingAwaitWarning → NuGet / GitHub
- Microsoft.CodeAnalysis.FxCopAnalyzers → NuGet / GitHub
- Microsoft.VisualStudio.Threading.Analyzers → NuGet / GitHub
- Philips.CodeAnalysis.DuplicateCodeAnalyzer → NuGet / GitHub. This analyzer is also parametrized using the DuplicateCode.Allowed.txt file
- Global.ruleset → define the code styling rules enforced by StyleCop and its StyleCop.Analyzers NuGet package (NuGet / GitHub)
- BannedSymbols.txt → the configuration file used by the Roslyn Analyzer Microsoft.CodeAnalysis.BannedApiAnalyzers (NuGet / GitHub)
- DuplicateCode.Allowed.txt → the file containing the exceptions allowed by the Philips.CodeAnalysis.DuplicateCodeAnalyzer (NuGet / GitHub)
- RiderInspectionSettings.xml → the configuration file used by JetBrains Rider for the editor inspections
This folder represents a directory containing an hypotetical ASP.NET 6 web application, inheriting and extending the settings contained into the Root folder, The files are:
- Directory.Build.props → Inherit and extends the Directory.Build.props contained into the parent folder, and hooks a Gulp task in the
BeforeTargets="PostBuildEvent"
that process the JS files using ESLint - package.json → install Babel, ESLint and other basic dependencies. Also define the
eslint
script launched via Gulp, used to execute ESLint - gulpFile.js → define the Gulp tasks used to process ESLint and SCSS. Search for the
TODO
comments into the file to customize your process - .eslintrc.js → an opinionated set of ESLint rules. Customize them as needed.
- .eslintignore → the file defining the paths that ESLint should ignore. Customize them as needed.