Merge pull request #39 from BelfordZ/feature/eslint-fix

feat(eslint) Add fix option to npm run commands
This commit is contained in:
filipnyquist 2017-10-13 07:04:38 +02:00 committed by GitHub
commit 3351b76775
3 changed files with 62 additions and 62 deletions

View file

@ -26,6 +26,7 @@
"start": "nodemon server/ --exec babel-node --ignore 'claimTrieCache.json'",
"build": "babel server -d dist",
"lint": "eslint ./server",
"lint-fix": "npm run lint -- --fix",
"test": "npm run lint && npm run mocha",
"prod": "npm run build && node dist/",
"mocha": "./node_modules/.bin/mocha --compilers js:babel-register --require babel-polyfill",

View file

@ -22,23 +22,23 @@ function getResults (input) {
if (input.size === undefined) input.size = 10;
if (input.from === undefined) input.from = 0;
return eclient.search({
index: "claims",
_source: ["name", "value", "claimId"],
body: {
"query": {
"bool": {
"must": {
"query_string": {
"query": '*' + input.s.trim() + '*',
"fields": [
"name",
"value.stream.metadata.author",
"value.stream.metadata.title",
"value.stream.metadata.description"
]
}
}
}
index : 'claims',
_source: ['name', 'value', 'claimId'],
body : {
'query': {
'bool': {
'must': {
'query_string': {
'query' : '*' + input.s.trim() + '*',
'fields': [
'name',
'value.stream.metadata.author',
'value.stream.metadata.title',
'value.stream.metadata.description',
],
},
},
},
},
size: input.size,
from: input.from,
@ -50,22 +50,22 @@ function getAutoComplete (input) {
if (input.size === undefined) input.size = 10;
if (input.from === undefined) input.from = 0;
return eclient.search({
index: "claims",
_source: ["name", "value.stream.metadata.title", "value.stream.metadata.author"],
body: {
"query": {
"bool": {
"must": {
"query_string": {
"query": "*" + input.s.trim() + "*",
"fields": [
"name",
"value.stream.metadata.title",
"value.stream.metadata.author"
]
}
}
}
index : 'claims',
_source: ['name', 'value.stream.metadata.title', 'value.stream.metadata.author'],
body : {
'query': {
'bool': {
'must': {
'query_string': {
'query' : '*' + input.s.trim() + '*',
'fields': [
'name',
'value.stream.metadata.title',
'value.stream.metadata.author',
],
},
},
},
},
size: input.size,
from: input.from,

View file

@ -27,41 +27,40 @@ const eclient = new elasticsearch.Client({
});
const queue = new ElasticQueue({elastic: eclient});
//Get the lbrycrd config from the .lbrycrd folder.
// Get the lbrycrd config from the .lbrycrd folder.
function getClient () {
return new Promise((resolve, reject) => {
fileExists(path.join(os.homedir(), '.lbrycrd/lbrycrd.conf'), (err, exists) => {
if (err) { reject(err) };
let config = {'username': 'lbry', 'password': 'lbry', 'rpc_port': 9245};
if (exists) {
let prop = PropertiesReader(path.join(os.homedir(), '.lbrycrd/lbrycrd.conf'));
config.username = prop.get('rpcuser');
config.password = prop.get('rpcpassword');
config.rpc_port = prop.get('rpcport');
let client = new bitcoin.Client({
host : 'localhost',
port : config.rpc_port,
user : config.username,
pass : config.password,
timeout: 30000,
fileExists(path.join(os.homedir(), '.lbrycrd/lbrycrd.conf'), (err, exists) => {
if (err) { reject(err) };
let config = {'username': 'lbry', 'password': 'lbry', 'rpc_port': 9245};
if (exists) {
let prop = PropertiesReader(path.join(os.homedir(), '.lbrycrd/lbrycrd.conf'));
config.username = prop.get('rpcuser');
config.password = prop.get('rpcpassword');
config.rpc_port = prop.get('rpcport');
let client = new bitcoin.Client({
host : 'localhost',
port : config.rpc_port,
user : config.username,
pass : config.password,
timeout: 30000,
});
resolve(client);
} else {
let client = new bitcoin.Client({
host : 'localhost',
port : config.rpc_port,
user : config.username,
pass : config.password,
timeout: 30000,
});
resolve(client);
}
});
resolve(client);
} else {
let client = new bitcoin.Client({
host : 'localhost',
port : config.rpc_port,
user : config.username,
pass : config.password,
timeout: 30000,
});
resolve(client);
}
});
});
}
//Check that our cache file exist.
// Check that our cache file exist.
fileExists(path.join(appRoot.path, 'claimTrieCache.json'), (err, exists) => {
if (err) { throw err };
if (!exists) {