Added "standard", and enforced it via "husky", i.e. all commits will make the code go through a pass of "standard" and fail if standard can't fix it;

Also made a pass on the existing files.
This commit is contained in:
Vasil Rangelov 2019-08-30 17:37:46 +03:00
parent eebb2cb219
commit 53da62b914
4 changed files with 2118 additions and 12 deletions

View File

@ -44,12 +44,12 @@ module.exports.create = function (config) {
defaultHeaders['X-Auth-Key'] = config.authKey
}
function api (method, path, body, tokenType) {
const headers = defaultHeaders;
const headers = defaultHeaders
if (tokenType && config.bearerTokens) {
if (!(tokenType in config.bearerTokens)) {
throw new Error('Unrecognized token type');
throw new Error('Unrecognized token type')
}
headers['Authorization'] = 'Bearer ' + config.bearerTokens[tokenType];
headers.Authorization = 'Bearer ' + config.bearerTokens[tokenType]
}
return request({
url: baseUrl + path,
@ -118,9 +118,9 @@ module.exports.create = function (config) {
formatError('Could not read record', resp)
}
let {result} = resp.body
const { result } = resp.body
let record = result.filter(record => (record.type === 'TXT' && record.content === txtRecord))[0]
const record = result.filter(record => (record.type === 'TXT' && record.content === txtRecord))[0]
if (record) {
const resp = await api('DELETE', `/zones/${zone.id}/dns_records/${record.id}`, undefined, 'zone')
@ -149,9 +149,9 @@ module.exports.create = function (config) {
formatError('Could not read record', resp)
}
let {result} = resp.body
const { result } = resp.body
let record = result.filter(record => (record.type === 'TXT' && record.content === txtRecord))[0]
const record = result.filter(record => (record.type === 'TXT' && record.content === txtRecord))[0]
if (record) {
return { dnsAuthorization: record.content }

2099
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,13 @@
"@root/request": "^1.3.11"
},
"devDependencies": {
"acme-dns-01-test": "^3.2.1"
"acme-dns-01-test": "^3.2.1",
"standard": "^14.1.0",
"husky": "^3.0.4"
},
"husky": {
"hooks": {
"pre-commit": "npx standard --fix && git update-index --again"
}
}
}