Fix linter errors

# Conflicts:
#	lib/contracts/contribution.js
#	lib/contracts/contributor.js
#	lib/contracts/proposal.js
#	lib/kredits.js
#	lib/utils/pagination.js
This commit is contained in:
fsmanuel 2019-04-12 23:31:20 +02:00
parent e405644b1d
commit a9093c1c40
13 changed files with 77 additions and 78 deletions

View File

@ -2,11 +2,15 @@ const Base = require('./base');
const EthersUtils = require('ethers').utils;
class Acl extends Base {
hasPermission (fromAddress, contractAddress, roleID, params = null) {
let roleHash = EthersUtils.keccak256(EthersUtils.toUtf8Bytes(roleID));
console.log(roleHash)
return this.functions.hasPermission(fromAddress, contractAddress, roleHash, params);
return this.functions.hasPermission(
fromAddress,
contractAddress,
roleHash,
params
);
}
}

View File

@ -1,5 +1,3 @@
const ethers = require('ethers');
const ContributionSerializer = require('../serializers/contribution');
const Base = require('./base');
@ -10,7 +8,7 @@ class Contribution extends Base {
let contributions = [];
for (let id = 1; id <= count; id++) {
const contribution = await this.getById(id)
const contribution = await this.getById(id);
contributions.push(contribution);
}
@ -23,7 +21,6 @@ class Contribution extends Base {
.then(data => {
return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
});
}
getByContributorId (contributorId) {

View File

@ -4,5 +4,5 @@ module.exports = {
Proposal: require('./proposal'),
Token: require('./token'),
Kernel: require('./kernel'),
Acl: require('./acl')
Acl: require('./acl'),
};

View File

@ -48,4 +48,4 @@ class Proposal extends Base {
}
}
module.exports = Proposal
module.exports = Proposal;

View File

@ -9,19 +9,19 @@ const ABIS = {
Token: require('./abis/Token.json'),
Proposal: require('./abis/Proposal.json'),
Kernel: require('./abis/Kernel.json'),
Acl: require('./abis/ACL.json')
Acl: require('./abis/ACL.json'),
};
const APP_CONTRACTS = [
'Contributor',
'Contribution',
'Token',
'Proposal',
'Acl'
'Acl',
];
const DaoAddresses = require('./addresses/dao.json');
const Contracts = require('./contracts');
const IPFS = require('./utils/ipfs')
const IPFS = require('./utils/ipfs');
// Helpers
function capitalize (word) {
@ -57,7 +57,7 @@ class Kredits {
);
});
});
return RSVP.all(addressPromises).then(() => { return this });
return RSVP.all(addressPromises).then(() => { return this; });
});
}

View File

@ -26,24 +26,24 @@ class Contribution {
kind,
description,
url,
details
details,
} = this;
let data = {
"@context": "https://schema.kosmos.org",
"@type": "Contribution",
"contributor": {
"ipfs": contributorIpfsHash
'@context': 'https://schema.kosmos.org',
'@type': 'Contribution',
'contributor': {
'ipfs': contributorIpfsHash,
},
date,
time,
kind,
description,
"details": details || {}
'details': details || {},
};
if (url) {
data["url"] = url;
data['url'] = url;
}
// Write it pretty to ipfs

View File

@ -64,7 +64,7 @@ class Contributor {
"@type": "Contributor",
kind,
name,
"accounts": []
"accounts": [],
};
if (url) {
@ -76,7 +76,7 @@ class Contributor {
"site": "github.com",
"uid": github_uid,
"username": github_username,
"url": `https://github.com/${github_username}`
"url": `https://github.com/${github_username}`,
});
}
@ -84,7 +84,7 @@ class Contributor {
data.accounts.push({
"site": "wiki.kosmos.org",
"username": wiki_username,
"url": `https://wiki.kosmos.org/User:${wiki_username}`
"url": `https://wiki.kosmos.org/User:${wiki_username}`,
});
}

View File

@ -2,7 +2,6 @@ const ipfsClient = require('ipfs-http-client');
const multihashes = require('multihashes');
class IPFS {
constructor (config) {
if (!config) {
config = { host: 'localhost', port: '5001', protocol: 'http' };
@ -48,7 +47,7 @@ class IPFS {
hashDigest: '0x' + multihashes.toHexString(multihash.digest),
hashSize: multihash.length,
hashFunction: multihash.code,
ipfsHash: ipfsHash
ipfsHash: ipfsHash,
};
}
@ -56,7 +55,6 @@ class IPFS {
let digest = ipfsClient.Buffer.from(hashData.hashDigest.slice(2), 'hex');
return multihashes.encode(digest, hashData.hashFunction, hashData.hashSize);
}
}
module.exports = IPFS;

View File

@ -4,12 +4,12 @@ const validator = tv4.freshApi();
validator.addFormat({
'date': function(value) {
const dateRegexp = /^[0-9]{4,}-[0-9]{2}-[0-9]{2}$/;
return dateRegexp.test(value) ? null : "A valid ISO 8601 full-date string is expected";
return dateRegexp.test(value) ? null : 'A valid ISO 8601 full-date string is expected';
},
'time': function(value) {
const timeRegexp = /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))$/;
return timeRegexp.test(value) ? null : "A valid ISO 8601 full-time string is expected";
}
})
return timeRegexp.test(value) ? null : 'A valid ISO 8601 full-time string is expected';
},
});
module.exports = validator;