Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal Nagar committed Aug 11, 2021
1 parent 17395c6 commit faf2883
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 46 deletions.
14 changes: 7 additions & 7 deletions .eslintrc.json → .eslintrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"extends": [
"plugin:github/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
Expand Down Expand Up @@ -51,4 +51,4 @@
"es6": true,
"jest/globals": true
}
}
}
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: npm install
- name: Release (dry-run)
run: npm run release -- --dry-run
# - name: Install dependencies
# run: npm install
# - name: Release (dry-run)
# run: npm run release -- --dry-run
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"semi": false,
"singleQuote": true,
"bracketSpacing": true,
"trailingComma": "all",
"useTabs": false,
"tabWidth": 2,
"printWidth": 80
}
10 changes: 0 additions & 10 deletions .prettierrc.json

This file was deleted.

9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"eslint.enable": true,
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.rulers": [80],
"files.insertFinalNewline": true
}
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ module.exports = {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
}
76 changes: 71 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"scripts": {
"pre-commit": "lint-staged",
"build": "tsc",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"format": "prettier --write src/**/*.ts",
"format-check": "prettier --check src/**/*.ts",
"lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt",
"test": "jest",
Expand Down Expand Up @@ -57,12 +57,15 @@
"@semantic-release/release-notes-generator": "9.0.3",
"@types/jest": "26.0.24",
"@types/node": "14.14.9",
"@typescript-eslint/parser": "4.29.0",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.0",
"@vercel/ncc": "0.29.0",
"conventional-changelog-conventionalcommits": "4.6.0",
"eslint": "7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-github": "4.1.5",
"eslint-plugin-jest": "24.4.0",
"eslint-plugin-prettier": "^3.4.0",
"husky": "6.0.0",
"jest": "26.6.3",
"jest-circus": "26.6.3",
Expand Down
29 changes: 13 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable github/array-foreach */
import {context, getOctokit} from '@actions/github'
import {info, getInput, setFailed} from '@actions/core'
import {IncomingWebhook} from '@slack/webhook'
import { context, getOctokit } from '@actions/github'
import { info, getInput, setFailed } from '@actions/core'
import { IncomingWebhook } from '@slack/webhook'

async function run(): Promise<void> {
try {
Expand Down Expand Up @@ -65,11 +62,11 @@ async function run(): Promise<void> {
type: 'section',
text: {
type: 'mrkdwn',
text: `You have ${alerts.length} vulnerabilities in *${owner}/${repo}*`
}
text: `You have ${alerts.length} vulnerabilities in *${owner}/${repo}*`,
},
})
blocks.push({
type: 'divider'
type: 'divider',
})
alerts.forEach((alert: any) => {
blocks.push({
Expand All @@ -81,30 +78,30 @@ async function run(): Promise<void> {
*Vulnerability Version Range:* ${alert.node.securityVulnerability.vulnerableVersionRange}
*Severity:* ${alert.node.securityAdvisory.severity}
*Summary:* ${alert.node.securityVulnerability.advisory.summary}
`
`,
},
accessory: {
type: 'button',
text: {
type: 'plain_text',
text: 'View Advisory',
emoji: true
emoji: true,
},
style: 'danger',
url: alert.node.securityAdvisory.permalink
}
url: alert.node.securityAdvisory.permalink,
},
})
})
console.log(blocks)
await webhook.send({
blocks,
icon_emoji: '🐛',
username: 'boop'
username: 'boop',
})
console.log(
JSON.stringify(
(result as any).organization.repository.vulnerabilityAlerts
)
(result as any).organization.repository.vulnerabilityAlerts,
),
)
}
} catch (err) {
Expand Down
Empty file added src/sources/slack.ts
Empty file.

0 comments on commit faf2883

Please sign in to comment.