diff --git a/.github/workflows/generate-code-scanning-query-lists.yml b/.github/workflows/generate-code-scanning-query-lists.yml index 9a29cab656..e5228e82b9 100644 --- a/.github/workflows/generate-code-scanning-query-lists.yml +++ b/.github/workflows/generate-code-scanning-query-lists.yml @@ -71,6 +71,20 @@ jobs: with: token: ${{ secrets.DOCS_BOT_PAT_WORKFLOW }} + - name: Lint the code (eslint) + if: ${{ github.event_name == 'pull_request' }} + env: + PATH: '$PATH:${{ github.workspace }}/node_modules/.bin' + run: | + eslint --no-ignore src/code-scanning/scripts/generate-code-scanning-query-list.ts + + - name: Lint the code (tsc) + if: ${{ github.event_name == 'pull_request' }} + env: + PATH: '$PATH:${{ github.workspace }}/node_modules/.bin' + run: | + tsc --noEmit --project src/code-scanning/scripts/tsconfig.json + - name: Build code scanning query list run: | for lang in "cpp" "csharp" "go" "java" "javascript" "python" "ruby" "swift"; do diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index d51c0be647..041d2cd7e6 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -39,10 +39,6 @@ jobs: - uses: ./.github/actions/node-npm-setup - - uses: ./.github/actions/install-cocofix - with: - token: ${{ secrets.DOCS_BOT_PAT_WORKFLOW }} - - name: Run linter run: npm run lint diff --git a/package.json b/package.json index 6543c3824e..4bb8a17c8c 100644 --- a/package.json +++ b/package.json @@ -193,7 +193,8 @@ "src/bookmarklets/*", "src/open-source/scripts/add-pr-links.js", "src/open-source/scripts/pr-link-source.js", - "rest-api-description/" + "rest-api-description/", + "src/code-scanning/scripts/generate-code-scanning-query-list.ts" ] }, "jest": { diff --git a/src/code-scanning/scripts/generate-code-scanning-query-list.ts b/src/code-scanning/scripts/generate-code-scanning-query-list.ts index 3b63af44ea..43e12dba34 100644 --- a/src/code-scanning/scripts/generate-code-scanning-query-list.ts +++ b/src/code-scanning/scripts/generate-code-scanning-query-list.ts @@ -201,7 +201,7 @@ async function main(options: Options, language: string) { } function printQueries(options: Options, queries: QueryExtended[], includeAutofix: boolean) { - const markdown = [] + const markdown: string[] = [] markdown.push('{% rowheaders %}') markdown.push('') // blank line const header = ['Query name', 'Related CWEs', 'Default', 'Extended'] diff --git a/src/code-scanning/scripts/tsconfig.json b/src/code-scanning/scripts/tsconfig.json new file mode 100644 index 0000000000..11ddf7df11 --- /dev/null +++ b/src/code-scanning/scripts/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "../../../tsconfig.json", + "include": ["generate-code-scanning-query-list.ts"], + "exclude": ["node_modules"] +} diff --git a/tsconfig.json b/tsconfig.json index 58ad36c7ec..8a59150f06 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,7 +26,8 @@ } }, "exclude": [ - "node_modules" + "node_modules", + "src/code-scanning/scripts/generate-code-scanning-query-list.ts" ], "include": [ "*.d.ts",