mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
refactor: enable keyword-spacing eslint rule
This commit is contained in:
parent
16fc854f57
commit
344ea3ae3f
15 changed files with 16 additions and 19 deletions
|
@ -31,7 +31,7 @@
|
|||
},
|
||||
"rules": {
|
||||
"no-tabs": 2,
|
||||
"keyword-spacing": 0,
|
||||
"keyword-spacing": 2,
|
||||
"padded-blocks": 0,
|
||||
"no-useless-escape": 0,
|
||||
"handle-callback-err": 2,
|
||||
|
|
|
@ -105,7 +105,7 @@ export default function(router: Router, auth: IAuth, storage: IStorageHandler, c
|
|||
|
||||
try {
|
||||
metadata = validate_metadata(req.body, name);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return next(ErrorCode.get422('bad incoming package data'));
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ export function allow(auth: IAuth) {
|
|||
} else {
|
||||
// send(null), send(204), etc.
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
// if verdaccio sends headers first, and then calls res.send()
|
||||
// as an error handler, we can't report error properly,
|
||||
// and should just close socket
|
||||
|
|
|
@ -348,7 +348,7 @@ class Auth {
|
|||
const b1 = c.update(buf);
|
||||
const b2 = c.final();
|
||||
return Buffer.concat([b1, b2]);
|
||||
} catch(_) {
|
||||
} catch (_) {
|
||||
return new Buffer(0);
|
||||
}
|
||||
}
|
||||
|
|
2
src/lib/bootstrap.js
vendored
2
src/lib/bootstrap.js
vendored
|
@ -4,7 +4,7 @@ import {assign, isObject, isFunction} from 'lodash';
|
|||
import Path from 'path';
|
||||
import URL from 'url';
|
||||
import fs from 'fs';
|
||||
import http from'http';
|
||||
import http from 'http';
|
||||
import https from 'https';
|
||||
// $FlowFixMe
|
||||
import constants from 'constants';
|
||||
|
|
|
@ -17,7 +17,7 @@ try {
|
|||
// for debugging memory leaks
|
||||
// totally optional
|
||||
require('heapdump');
|
||||
} catch(err) { }
|
||||
} catch (err) { }
|
||||
|
||||
const logger = require('./logger');
|
||||
logger.setup(); // default setup
|
||||
|
|
|
@ -231,7 +231,6 @@ class LocalStorage implements IStorage {
|
|||
let tarball = metadata.dist.tarball.replace(/.*\//, '');
|
||||
|
||||
if (isObject(data._attachments[tarball])) {
|
||||
|
||||
if (_.isNil(data._attachments[tarball].shasum) === false && _.isNil(metadata.dist.shasum) === false) {
|
||||
if (data._attachments[tarball].shasum != metadata.dist.shasum) {
|
||||
const errorMessage = `shasum error, ${data._attachments[tarball].shasum} != ${metadata.dist.shasum}`;
|
||||
|
|
|
@ -11,7 +11,7 @@ const pkgJSON = require('../../package.json');
|
|||
* @return {String} security level
|
||||
*/
|
||||
function getlvl(x) {
|
||||
switch(true) {
|
||||
switch (true) {
|
||||
case x < 15: return 'trace';
|
||||
case x < 25: return 'debug';
|
||||
case x < 35: return 'info';
|
||||
|
|
|
@ -13,7 +13,7 @@ import type {Config} from '@verdaccio/types';
|
|||
function tryLoad(path: string) {
|
||||
try {
|
||||
return require(path);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
if (err.code === 'MODULE_NOT_FOUND') {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ function generateRevision(rev: string): string {
|
|||
}
|
||||
|
||||
function cleanUpReadme(version: Version): Version {
|
||||
if(_.isNil(version) === false) {
|
||||
if (_.isNil(version) === false) {
|
||||
delete version.readme;
|
||||
}
|
||||
|
||||
|
|
|
@ -461,7 +461,7 @@ class Storage implements IStorageHandler {
|
|||
|
||||
try {
|
||||
validate_metadata(upLinkResponse, name);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
self.logger.error({
|
||||
sub: 'out',
|
||||
err: err,
|
||||
|
@ -484,7 +484,7 @@ class Storage implements IStorageHandler {
|
|||
try {
|
||||
mergeVersions(packageInfo, upLinkResponse);
|
||||
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
self.logger.error({
|
||||
sub: 'out',
|
||||
err: err,
|
||||
|
|
|
@ -161,7 +161,7 @@ class ProxyStorage implements IProxy {
|
|||
try {
|
||||
// $FlowFixMe
|
||||
body = JSON.parse(body.toString('utf8'));
|
||||
} catch(_err) {
|
||||
} catch (_err) {
|
||||
body = {};
|
||||
err = _err;
|
||||
error = err.message;
|
||||
|
@ -639,7 +639,6 @@ class ProxyStorage implements IProxy {
|
|||
this.logger.debug( {url: this.url.href, proxy: this.proxy}, 'using proxy @{proxy} for @{url}' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default ProxyStorage;
|
||||
|
|
|
@ -69,7 +69,7 @@ export function fetchUplinkMetadata(name: string, packageInfo: Package,
|
|||
|
||||
try {
|
||||
validate_metadata(upLinkResponse, name);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
logger.error({
|
||||
sub: 'out',
|
||||
err: err,
|
||||
|
@ -91,7 +91,7 @@ export function fetchUplinkMetadata(name: string, packageInfo: Package,
|
|||
|
||||
try {
|
||||
mergeVersions(packageInfo, upLinkResponse);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
logger.error({
|
||||
sub: 'out',
|
||||
err: err,
|
||||
|
|
|
@ -367,7 +367,7 @@ function folder_exists(path: string) {
|
|||
try {
|
||||
const stat = fs.statSync(path);
|
||||
return stat.isDirectory();
|
||||
} catch(_) {
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ function fileExists(path: string) {
|
|||
try {
|
||||
const stat = fs.statSync(path);
|
||||
return stat.isFile();
|
||||
} catch(_) {
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,5 +123,4 @@ export default class Home extends React.Component {
|
|||
renderPackageList() {
|
||||
return <PackageList help={this.state.fistTime} packages={this.state.packages} />;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue