From 70c3999af1728c9200dfb0518f4c4286acdb623b Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Sat, 10 Nov 2018 19:32:43 -0500 Subject: [PATCH] update eslintrc fix errors --- .eslintrc | 17 +++++++---------- client/src/sagas/show_uri.js | 4 ++-- .../availability/checkClaimAvailability.js | 2 +- server/controllers/utils/getClaimId.js | 2 +- server/middleware/logMetricsMiddleware.js | 4 ++-- server/models/trending.js | 2 +- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.eslintrc b/.eslintrc index 2a9389db..81112c64 100644 --- a/.eslintrc +++ b/.eslintrc @@ -12,16 +12,13 @@ "rules": { "no-multi-spaces": 0, "new-cap": 0, - "prefer-promise-reject-errors":0, - "comma-dangle": [ - "error", - "always-multiline" - ], - "semi": [ - "error", - "always", - { "omitLastInOneLineBlock": true } - ], + "prefer-promise-reject-errors": 0, + "no-unused-vars": 0, + "standard/object-curly-even-spacing": 0, + "handle-callback-err": 0, + "one-var": 0, + "comma-dangle": ["error", "always-multiline"], + "semi": ["error", "always", { "omitLastInOneLineBlock": true }], "key-spacing": [ "error", { diff --git a/client/src/sagas/show_uri.js b/client/src/sagas/show_uri.js index f95dc73a..52bcf061 100644 --- a/client/src/sagas/show_uri.js +++ b/client/src/sagas/show_uri.js @@ -30,8 +30,8 @@ function * parseAndUpdateIdentifierAndClaim (modifier, claim) { } function * parseAndUpdateClaimOnly (claim) { - if (/^special\:/.test(claim) === true) { - const assetName = /special\:(.*)/.exec(claim)[1]; + if (/^special:/.test(claim) === true) { + const assetName = /special:(.*)/.exec(claim)[1]; return yield call(newSpecialAssetRequest, onNewSpecialAssetRequest(assetName)); } else { // this could be a request for an asset or a channel page diff --git a/server/controllers/api/claim/availability/checkClaimAvailability.js b/server/controllers/api/claim/availability/checkClaimAvailability.js index 99a57c6c..9ed01c77 100644 --- a/server/controllers/api/claim/availability/checkClaimAvailability.js +++ b/server/controllers/api/claim/availability/checkClaimAvailability.js @@ -7,7 +7,7 @@ const claimAvailability = async (name) => { const claimAddresses = additionalClaimAddresses || []; claimAddresses.push(primaryClaimAddress); // find any records where the name is used - return await chainquery.claim + return chainquery.claim .findAll({ attributes: ['claim_address'], where : { diff --git a/server/controllers/utils/getClaimId.js b/server/controllers/utils/getClaimId.js index 5b0f1704..0ac5b63c 100644 --- a/server/controllers/utils/getClaimId.js +++ b/server/controllers/utils/getClaimId.js @@ -24,7 +24,7 @@ const getClaimIdByChannel = async (channelName, channelClaimId, claimName) => { const getClaimId = async (channelName, channelClaimId, name, claimId) => { logger.debug(`getClaimId: ${channelName}, ${channelClaimId}, ${name}, ${claimId})`); if (channelName) { - return await getClaimIdByChannel(channelName, channelClaimId, name); + return getClaimIdByChannel(channelName, channelClaimId, name); } else { let claimIdResult = await chainquery.claim.queries.getLongClaimId(name, claimId); diff --git a/server/middleware/logMetricsMiddleware.js b/server/middleware/logMetricsMiddleware.js index d19c3e9e..e4ddaceb 100644 --- a/server/middleware/logMetricsMiddleware.js +++ b/server/middleware/logMetricsMiddleware.js @@ -15,7 +15,7 @@ function logMetricsMiddleware (req, res, next) { referrer = /(.*?)#.*/.exec(referrer)[1]; } catch (e) { // Cheap forced string conversion & clamp - referrer = new String(referrer); + referrer = String(referrer); referrer = referrer.substr(0, 255); } @@ -27,7 +27,7 @@ function logMetricsMiddleware (req, res, next) { db.Metrics.create({ time : Date.now(), - isInternal: /node\-fetch/.test(userAgent), + isInternal: /node-fetch/.test(userAgent), isChannel : res.isChannel, claimId : res.claimId, routePath : httpContext.get('routePath'), diff --git a/server/models/trending.js b/server/models/trending.js index 55c9a6f3..dcb44dc5 100644 --- a/server/models/trending.js +++ b/server/models/trending.js @@ -67,7 +67,7 @@ module.exports = (sequelize, { BOOLEAN, DATE, FLOAT, INTEGER, STRING }) => { const whereString = `isChannel = false and time > '${sqlTime}'`; const query = `SELECT ${selectString} FROM Trending WHERE ${whereString} ORDER BY weight DESC LIMIT ${limit}`; - return await sequelize.query(query, { type: sequelize.QueryTypes.SELECT }); + return sequelize.query(query, { type: sequelize.QueryTypes.SELECT }); }; Trending.getTrendingClaims = async () => {