Adds liniting into the workflow (#3082)
* initial linting of src * fix indent to 2 spaces * Removes unnecessary rules * ignore spec folder for now * Spec linting * Fix spec indent * nits * nits * no no-empty rule
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/*eslint no-unused-vars: "off"*/
|
||||
export class CacheAdapter {
|
||||
/**
|
||||
* Get a value in the cache
|
||||
|
||||
@@ -7,7 +7,7 @@ export class InMemoryCacheAdapter {
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise((resolve) => {
|
||||
let record = this.cache.get(key);
|
||||
if (record == null) {
|
||||
return resolve(null);
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
export class NullCacheAdapter {
|
||||
|
||||
constructor(ctx) {
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
get(key) {
|
||||
return new Promise((resolve, _) => {
|
||||
get() {
|
||||
return new Promise((resolve) => {
|
||||
return resolve(null);
|
||||
})
|
||||
}
|
||||
|
||||
put(key, value, ttl) {
|
||||
put() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
del(key) {
|
||||
del() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import logger from '../../logger';
|
||||
|
||||
const DEFAULT_REDIS_TTL = 30 * 1000; // 30 seconds in milliseconds
|
||||
|
||||
function debug() {
|
||||
function debug() {
|
||||
logger.debug.apply(logger, ['RedisCacheAdapter', ...arguments]);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ export class RedisCacheAdapter {
|
||||
|
||||
get(key) {
|
||||
debug('get', key);
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve, _) => {
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve) => {
|
||||
this.client.get(key, function(err, res) {
|
||||
debug('-> get', key, res);
|
||||
if(!res) {
|
||||
@@ -39,14 +39,14 @@ export class RedisCacheAdapter {
|
||||
if (ttl < 0 || isNaN(ttl)) {
|
||||
ttl = DEFAULT_REDIS_TTL;
|
||||
}
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve, _) => {
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve) => {
|
||||
if (ttl === Infinity) {
|
||||
this.client.set(key, value, function(err, res) {
|
||||
this.client.set(key, value, function() {
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
this.client.psetex(key, ttl, value, function(err, res) {
|
||||
this.client.psetex(key, ttl, value, function() {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
@@ -57,9 +57,9 @@ export class RedisCacheAdapter {
|
||||
|
||||
del(key) {
|
||||
debug('del', key);
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve, _) => {
|
||||
this.client.del(key, function(err, res) {
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve) => {
|
||||
this.client.del(key, function() {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
@@ -69,9 +69,9 @@ export class RedisCacheAdapter {
|
||||
|
||||
clear() {
|
||||
debug('clear');
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve, _) => {
|
||||
this.client.flushall(function(err, res) {
|
||||
this.p = this.p.then(() => {
|
||||
return new Promise((resolve) => {
|
||||
this.client.flushall(function() {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user