Skip to content
Permalink
Browse files
Setup editor integrations and clean up linting
  • Loading branch information
Philip Harrison committed Jul 21, 2021
1 parent 42364b8 commit 904dc1fef4b26a17329a7c9831721ed16cfe249c
Showing 13 changed files with 756 additions and 39 deletions.
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
charset = utf-8
insert_final_newline = true

[*.json, *.ts]
indent_size = 2
indent_style = space

[*.md]
trim_trailing_whitespace = false
indent_size = 2
@@ -1,23 +1,23 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"extends": ["plugin:github/recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
"project": "./tsconfig.eslint.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"camelcase": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
@@ -41,8 +41,6 @@
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/no-shadow": "error",
@@ -53,4 +51,4 @@
"es6": true,
"jest/globals": true
}
}
}
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
@@ -0,0 +1,8 @@
{
"recommendations": [
"EditorConfig.editorconfig",
"Orta.vscode-jest",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
@@ -0,0 +1,16 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript", "typescript"],
"eslint.alwaysShowStatus": true,
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"editor.formatOnPaste": false,
"editor.formatOnType": false
}
@@ -1,13 +1,2 @@
import * as process from 'process'
import * as cp from 'child_process'
import * as path from 'path'

// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
const np = process.execPath
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecFileSyncOptions = {
env: process.env
}
console.log(cp.execFileSync(np, [ip], options).toString())
})
test('test runs', () => {})
@@ -22,27 +22,37 @@ describe('Updater', () => {
if (!containers) return

containers.forEach(function (containerInfo) {
if (containerInfo.Image.includes('docker.pkg.github.com/dependabot/dependabot-updater')) {
console.log('removing');
if (
containerInfo.Image.includes(
'docker.pkg.github.com/dependabot/dependabot-updater'
)
) {
console.log('removing')

docker.getContainer(containerInfo.Id).remove();
docker.getContainer(containerInfo.Id).remove()
}
});
});
});
})
})
})

jest.setTimeout(20000)
it('should fetch manifests', async () => {
mockDependabotAPI.getJobDetails.mockImplementation(() => {
return JSON.parse(fs.readFileSync(path.join(__dirname, "fixtures/job-details/npm.json")).toString()).data.attributes
return JSON.parse(
fs
.readFileSync(path.join(__dirname, 'fixtures/job-details/npm.json'))
.toString()
).data.attributes
})
mockDependabotAPI.getCredentials.mockImplementation(() => {
return [{
type: "git_source",
host: "github.com",
username: "x-access-token",
password: process.env.GITHUB_TOKEN,
}]
return [
{
type: 'git_source',
host: 'github.com',
username: 'x-access-token',
password: process.env.GITHUB_TOKEN
}
]
})

await updater.pullImage()

0 comments on commit 904dc1f

Please sign in to comment.