mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-03-18 02:22:46 -05:00
refactor: enable padded-blocks eslint rule
This commit is contained in:
parent
344ea3ae3f
commit
7c44dabaec
12 changed files with 1 additions and 23 deletions
|
@ -32,7 +32,7 @@
|
|||
"rules": {
|
||||
"no-tabs": 2,
|
||||
"keyword-spacing": 2,
|
||||
"padded-blocks": 0,
|
||||
"padded-blocks": 2,
|
||||
"no-useless-escape": 0,
|
||||
"handle-callback-err": 2,
|
||||
"no-debugger": 2,
|
||||
|
|
|
@ -17,7 +17,6 @@ const route = Router(); /* eslint new-cap: 0 */
|
|||
This file include all verdaccio only API(Web UI), for npm API please see ../endpoint/
|
||||
*/
|
||||
module.exports = function(config: Config, auth: IAuth, storage: IStorageHandler) {
|
||||
|
||||
Search.configureStorage(storage);
|
||||
|
||||
// validate all of these params as a package name
|
||||
|
|
|
@ -148,7 +148,6 @@ class Auth {
|
|||
}
|
||||
|
||||
p.allow_access(user, pkg, function(err, ok) {
|
||||
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
|
1
src/lib/bootstrap.js
vendored
1
src/lib/bootstrap.js
vendored
|
@ -91,7 +91,6 @@ function startVerdaccio(config: any, cliListen: string,
|
|||
callback(webServer, addr, pkgName, pkgVersion);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function unlinkAddressPath(addr) {
|
||||
|
|
|
@ -66,7 +66,6 @@ function normalizeUserlist() {
|
|||
* Coordinates the application configuration
|
||||
*/
|
||||
class Config {
|
||||
|
||||
/**
|
||||
* @param {*} config config the content
|
||||
*/
|
||||
|
@ -84,11 +83,9 @@ class Config {
|
|||
if (self[configProp] == null) {
|
||||
self[configProp] = config[configProp];
|
||||
}
|
||||
|
||||
}
|
||||
if (!self.user_agent) {
|
||||
self.user_agent = `${pkgName}/${pkgVersion}`;
|
||||
|
||||
}
|
||||
|
||||
// some weird shell scripts are valid yaml files parsed as string
|
||||
|
|
|
@ -41,7 +41,6 @@ import type {IStorage, StringValue} from '../../types';
|
|||
* Implements Storage interface (same for storage.js, local-storage.js, up-storage.js).
|
||||
*/
|
||||
class LocalStorage implements IStorage {
|
||||
|
||||
config: Config;
|
||||
localData: ILocalData;
|
||||
logger: Logger;
|
||||
|
@ -260,7 +259,6 @@ class LocalStorage implements IStorage {
|
|||
|
||||
cb();
|
||||
});
|
||||
|
||||
}, callback);
|
||||
}
|
||||
|
||||
|
@ -325,7 +323,6 @@ class LocalStorage implements IStorage {
|
|||
|
||||
this._updatePackage(name, (jsonData, cb) => {
|
||||
for (let ver in jsonData.versions) {
|
||||
|
||||
if (_.isNil(pkg.versions[ver])) {
|
||||
this.logger.info( {name: name, version: ver}, 'unpublishing @{name}@@{version}');
|
||||
|
||||
|
@ -337,7 +334,6 @@ class LocalStorage implements IStorage {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jsonData[DIST_TAGS] = pkg[DIST_TAGS];
|
||||
|
@ -553,7 +549,6 @@ class LocalStorage implements IStorage {
|
|||
* @return {Function}
|
||||
*/
|
||||
getPackageMetadata(name: string, callback?: Callback = () => {}): void {
|
||||
|
||||
const storage: IPackageStorage = this._getLocalStorage(name);
|
||||
if (_.isNil(storage)) {
|
||||
return callback( ErrorCode.get404() );
|
||||
|
@ -863,7 +858,6 @@ class LocalStorage implements IStorage {
|
|||
return plugin.getPackageStorage;
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default LocalStorage;
|
||||
|
|
|
@ -7,7 +7,6 @@ import type {IStorageHandler, IWebSearch} from '../../types';
|
|||
* Handle the search Indexer.
|
||||
*/
|
||||
class Search implements IWebSearch {
|
||||
|
||||
index: any;
|
||||
storage: IStorageHandler;
|
||||
|
||||
|
|
|
@ -124,7 +124,6 @@ export function checkPackageRemote(name: string, isAllowPublishOffline: boolean,
|
|||
return new Promise((resolve, reject) => {
|
||||
// $FlowFixMe
|
||||
syncMetadata(name, null, {}, (err, packageJsonLocal, upLinksErrors) => {
|
||||
|
||||
// something weird
|
||||
if (err && err.status !== 404) {
|
||||
return reject(err);
|
||||
|
@ -140,7 +139,6 @@ export function checkPackageRemote(name: string, isAllowPublishOffline: boolean,
|
|||
// if uplink fails with a status other than 404, we report failure
|
||||
if (_.isNil(upLinksErrors[errorItem][0]) === false) {
|
||||
if (upLinksErrors[errorItem][0].status !== 404) {
|
||||
|
||||
if (isAllowPublishOffline) {
|
||||
return resolve();
|
||||
}
|
||||
|
|
|
@ -434,12 +434,10 @@ class Storage implements IStorageHandler {
|
|||
}
|
||||
|
||||
async.map(upLinks, (upLink, cb) => {
|
||||
|
||||
const _options = Object.assign({}, options);
|
||||
let upLinkMeta = packageInfo._uplinks[upLink.upname];
|
||||
|
||||
if (isObject(upLinkMeta)) {
|
||||
|
||||
const fetched = upLinkMeta.fetched;
|
||||
|
||||
if (fetched && (Date.now() - fetched) < upLink.maxage) {
|
||||
|
@ -483,7 +481,6 @@ class Storage implements IStorageHandler {
|
|||
|
||||
try {
|
||||
mergeVersions(packageInfo, upLinkResponse);
|
||||
|
||||
} catch (err) {
|
||||
self.logger.error({
|
||||
sub: 'out',
|
||||
|
|
|
@ -40,13 +40,11 @@ export function updateVersionsHiddenUpLink(versions: Versions, upLink: IProxy) {
|
|||
|
||||
export function fetchUplinkMetadata(name: string, packageInfo: Package,
|
||||
options: any, upLink: any, logger: Logger): Promise<any> {
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
const _options = Object.assign({}, options);
|
||||
const upLinkMeta = packageInfo._uplinks[upLink.upname];
|
||||
|
||||
if (isObject(upLinkMeta)) {
|
||||
|
||||
const fetched = upLinkMeta.fetched;
|
||||
|
||||
// check whether is too soon to ask for metadata
|
||||
|
|
|
@ -9,7 +9,6 @@ import NoItems from '../NoItems';
|
|||
import classes from './packageList.scss';
|
||||
|
||||
export default class PackageList extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
packages: PropTypes.array,
|
||||
help: PropTypes.bool
|
||||
|
|
|
@ -13,7 +13,6 @@ import classes from './home.scss';
|
|||
|
||||
|
||||
export default class Home extends React.Component {
|
||||
|
||||
static propTypes = {
|
||||
children: PropTypes.element
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue