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