Skip to content

Commit

Permalink
Re-enable Blazor linting (#1283)
Browse files Browse the repository at this point in the history
# Pull Request

## 🀨 Rationale

#1280 

## πŸ‘©β€πŸ’» Implementation

It looks like a the build agent began pulling in a new version of the
.NET tools. `dotnet --info` prints out this for the CI build:
```
.NET SDKs installed:
  6.0.408 [/usr/share/dotnet/sdk]
  7.0.105 [/usr/share/dotnet/sdk]
  7.0.203 [/usr/share/dotnet/sdk]
  7.0.302 [/usr/share/dotnet/sdk]
```
So I'm guessing that 7.0.302 is causing issues.

I found
[dotnet/format#1800](dotnet/format#1800) which
is pretty close to what we're seeing. [This
comment](dotnet/format#1800 (comment))
makes it sound like there'll be a newer 7.0.3xx version that will fix
this problem, but the issue is still open so I guess that version isn't
out yet.
Also see
[dotnet/format#1834](dotnet/format#1834) and
[dotnet/sdk#32598](dotnet/sdk#32598) which
reference 7.0.302 and the DLL v4.6.0.0 specifically.

Changes in this PR:
- Re-enable Blazor C# linting in package.json
- Add a
[global.json](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json)
file to ensure the `dotnet` commands are using .NET 6.0.xxx tooling.
- This will ensure both the CI and local builds are using the .NET 6 SDK
for the `dotnet` CLI commands
- Add a pipeline step to print out `dotnet --info`, which will print out
all the installed .NET SDK versions, which should make it easier to
debug issues like this in the future
- Update docs to explicitly call out that a .NET SDK install `6.0.202 <=
v < 7` is required
- Update the CI build (`main.yml`) `setup-dotnet` action to refer to
global.json to get the required .NET version to install (so we're not
encoding the required version in multiple places in code)

## πŸ§ͺ Testing

CI build + re-built locally.

## βœ… Checklist

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed.
  • Loading branch information
msmithNI authored Jun 6, 2023
1 parent 89b88a2 commit 717b586
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
# Install dependencies
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
global-json-file: packages/nimble-blazor/global.json
- run: dotnet --info
working-directory: packages/nimble-blazor/
- uses: actions/setup-node@v3
with:
node-version: '16'
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ This repository uses the following tooling. See below for more info.
First step in development is to build the monorepo which requires the following to be installed:

- Node.js version 16+ (run `node --version`) and npm version 8+ (run `npm --version`) which can be downloaded from https://nodejs.org/en/download/
- .NET 6 SDK version 6.0.202+ (run `dotnet --version`) which can be downloaded from https://dotnet.microsoft.com/en-us/download
- .NET 6 SDK (`6.0.202 <= version < 7`) which can be downloaded from https://dotnet.microsoft.com/en-us/download
- Run `dotnet --info` to verify the required version of the SDK is installed. A `v6` install is required, but it's fine if later versions are installed too.

From the `nimble` directory:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Specify .NET 6 via global.json file; re-enable Blazor linting",
"packageName": "@ni/nimble-blazor",
"email": "[email protected]",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion packages/nimble-blazor/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Getting Started

If not already done, download and install the .NET 6 SDK version 6.0.202+ (run `dotnet --version`) which can be downloaded from https://dotnet.microsoft.com/en-us/download
If not already done, download and install the .NET SDK (see [the main contributing doc](/CONTRIBUTING.md) for the required version).

Initialize and build the Nimble monorepo (`npm install` + `npm run build` from the root `nimble` directory) before working with the Blazor codebase.

Expand Down
2 changes: 1 addition & 1 deletion packages/nimble-blazor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This repo contains:
- Visual Studio 2022 ([Enterprise, if available](https://my.visualstudio.com/Downloads?PId=8229)): Choose the "ASP.NET and Web Development" Workload in the installer
- Ensure Visual Studio is completely up to date (v17.1.6+): In Visual Studio click "Help" then "Check for Updates"
- **Mac with Visual Studio Code**: Install [Visual Studio Code](https://code.visualstudio.com/) and open it. Open the Extensions pane ("Preferences" >> "Extensions"), and search for / install the `ms-dotnettools.csharp` extension.
2. .NET 6 SDK: If not already done, download and install the .NET 6 SDK version 6.0.202+ (run `dotnet --version`) which can be downloaded from https://dotnet.microsoft.com/en-us/download
2. .NET SDK: See [the main contributing doc](/CONTRIBUTING.md) for the required version.

### Creating a new Blazor project

Expand Down
7 changes: 7 additions & 0 deletions packages/nimble-blazor/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "6.0.202",
"allowPrelease": "false",
"rollForward": "latestMinor"
}
}
2 changes: 1 addition & 1 deletion packages/nimble-blazor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"generate-icons:bundle": "rollup --bundleConfigAsCjs --config build/generate-icons/rollup.config.js",
"generate-icons:run": "node build/generate-icons/dist/index.js",
"generate-hybrid": "rollup --bundleConfigAsCjs --config build/generate-hybrid/rollup.config.js",
"lint": "npm run lint:js",
"lint": "npm run lint:cs && npm run lint:js",
"lint:cs": "dotnet format --verify-no-changes",
"lint:js": "eslint .",
"format": "npm run format:cs && npm run format:js",
Expand Down

0 comments on commit 717b586

Please sign in to comment.