Skip to content

Commit

Permalink
Add linting workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikhr committed Jan 28, 2024
1 parent 6e67c7a commit 24e9065
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 13 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run/ms-idp-workflow-run-auth
61 changes: 61 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Code Validation

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: {}

jobs:
root:
name: Node.js (main)
uses: ./.github/workflows/nodejs-lint-reusable.yml
with:
checkout-parameters: >
{
"submodules": true
}
npm-install-check-enable: true
npm-install-arguments: >
[
"--workspaces",
"--include-workspace-root",
"--install-links"
]
tsc-check-enable: true
tsc-parameters: >
{
"arguments": "--noEmit\n-p\n./jsconfig.json"
}
eslint-check-enable: true
prettier-check-enable: true

special-eslint:
name: Node.js (specialized for ${{ matrix.project }})
strategy:
matrix:
project:
- run/ms-idp-workflow-run-auth
uses: ./.github/workflows/nodejs-lint-reusable.yml
with:
checkout-parameters: >
{
"submodules": true
}
npm-install-arguments: >
[
"--workspace",
"${{ matrix.project }}",
"--include-workspace-root"
]
npm-install-check-enable: false
tsc-check-enable: false
eslint-check-enable: true
eslint-parameters: >
{
"npm-workspace": "${{ matrix.project }}"
}
prettier-check-enable: false
2 changes: 1 addition & 1 deletion lib/gh-actions-http-client/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const buildGhaHttpClient = require("./GhaHttpClient");
const buildGhaHttpClient = require("./GhaHttpClient.js");

Check failure on line 1 in lib/gh-actions-http-client/index.js

View workflow job for this annotation

GitHub Actions / Node.js (main) / ESLint

Unexpected use of file extension "js" for "./GhaHttpClient.js"

Unexpected use of file extension "js" for "./GhaHttpClient.js" eslint(import/extensions)

/**
* @param {import("@actions/core")} core
Expand Down
1 change: 0 additions & 1 deletion run/ms-idp-workflow-run-auth/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ rules:
- modules
- dynamicImport
node/no-missing-import: off
import/extensions: off
2 changes: 1 addition & 1 deletion run/ms-idp-workflow-run-auth/GhaAzAcsClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { HttpClientError, HttpCodes } = require("@actions/http-client");

const msalNode = import("@azure/msal-node");

const { onJwtToken } = require("./utils.js");
const { onJwtToken } = require("./utils");

const httpClientSym = Symbol("#httpClient");
const clientIdSym = Symbol("#clientId");
Expand Down
2 changes: 1 addition & 1 deletion run/ms-idp-workflow-run-auth/GhaMsalAccessTokenProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const msalNode = import("@azure/msal-node");

const buildMsalClient = require("../../lib/gh-actions-msal-client");

const utils = require("./utils.js");
const utils = require("./utils");

const { debug, info, isDebug } = core;

Expand Down
2 changes: 1 addition & 1 deletion run/ms-idp-workflow-run-auth/GhaServicePrincipalUpdater.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable node/no-unpublished-require */
const core = require("@actions/core");
const httpClientModule = require("@actions/http-client");
const { BearerCredentialHandler } = require("@actions/http-client/lib/auth.js");
const { BearerCredentialHandler } = require("@actions/http-client/lib/auth");

const buildGhaHttpClient = require("../../lib/gh-actions-http-client");

Expand Down
10 changes: 6 additions & 4 deletions run/ms-idp-workflow-run-auth/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ const httpClientModule = require("@actions/http-client");

const msalNodeModule = import("@azure/msal-node");

const { bindCoreHelpers } = require("../../lib/gh-actions-core-helpers");
const {
bindCoreHelpers,
} = require("../../lib/gh-actions-core-helpers");

Check failure on line 9 in run/ms-idp-workflow-run-auth/action.js

View workflow job for this annotation

GitHub Actions / Node.js (specialized for run/ms-idp-workflow-run-auth) / ESLint

Replace `⏎··bindCoreHelpers,⏎` with `·bindCoreHelpers·`

Replace `⏎··bindCoreHelpers,⏎` with `·bindCoreHelpers·` eslint(prettier/prettier) Potentially fixable with the `--fix` option.

Check failure on line 9 in run/ms-idp-workflow-run-auth/action.js

View workflow job for this annotation

GitHub Actions / Node.js (specialized for run/ms-idp-workflow-run-auth) / ESLint

Missing file extension "cjs" for "../../lib/gh-actions-core-helpers"

Missing file extension "cjs" for "../../lib/gh-actions-core-helpers" eslint(import/extensions)
const buildGhaHttpClient = require("../../lib/gh-actions-http-client");

const { saveStateEx: saveState } = bindCoreHelpers(ghaCore);
const { HttpClientError } = httpClientModule;
const { GhaHttpClient } = buildGhaHttpClient(ghaCore, httpClientModule);

const utils = require("./utils.js");

Check failure on line 16 in run/ms-idp-workflow-run-auth/action.js

View workflow job for this annotation

GitHub Actions / Node.js (specialized for run/ms-idp-workflow-run-auth) / ESLint

Unexpected use of file extension "js" for "./utils.js"

Unexpected use of file extension "js" for "./utils.js" eslint(import/extensions)
const GhaMsalAccessTokenProviderModule = require("./GhaMsalAccessTokenProvider.js");
const GhaServicePrincipalUpdater = require("./GhaServicePrincipalUpdater.js");
const GhaMsalAccessTokenProviderModule = require("./GhaMsalAccessTokenProvider");
const GhaServicePrincipalUpdater = require("./GhaServicePrincipalUpdater");

const GhaAzAcsClient = require("./GhaAzAcsClient.js");
const GhaAzAcsClient = require("./GhaAzAcsClient");
const { generateCertificate } = require("./GhaOpenSslCertProvider");

/**
Expand Down
10 changes: 6 additions & 4 deletions run/ms-idp-workflow-run-auth/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
const ghaCore = require("@actions/core");
const httpClientModule = require("@actions/http-client");

const { bindCoreHelpers } = require("../../lib/gh-actions-core-helpers");
const {
bindCoreHelpers,
} = require("../../lib/gh-actions-core-helpers/index.cjs");
const buildGhaHttpClient = require("../../lib/gh-actions-http-client");

const ghaHelpers = bindCoreHelpers(ghaCore);
const { GhaHttpClient } = buildGhaHttpClient(ghaCore, httpClientModule);

const utils = require("./utils.js");
const utils = require("./utils");

const GhaMsalAccessTokenProviderModule = require("./GhaMsalAccessTokenProvider.js");
const GhaServicePrincipalUpdater = require("./GhaServicePrincipalUpdater.js");
const GhaMsalAccessTokenProviderModule = require("./GhaMsalAccessTokenProvider");
const GhaServicePrincipalUpdater = require("./GhaServicePrincipalUpdater");

async function getState() {
const { getActionInputs } = utils;
Expand Down
4 changes: 4 additions & 0 deletions run/ms-idp-workflow-run-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"engines": {
"node": ">=20"
},
"scripts": {
"lint": "npm-run-all --continue-on-error lint:*",
"lint:eslint": "eslint -c ./.eslintrc.yml ."
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
Expand Down

0 comments on commit 24e9065

Please sign in to comment.