refactor: remove unnecessary FlowFixMe (#1051)

This commit is contained in:
Utwo 2018-10-05 12:08:54 +03:00 committed by Juan Picado @jotadeveloper
parent d41a990e97
commit 919828fd32
7 changed files with 1 additions and 11 deletions

View File

@ -39,7 +39,6 @@ export default function(router: Router, auth: IAuth, storage: IStorageHandler, c
// this is dumb and memory-consuming, but what choices do we have?
// flow: we need first refactor this file before decides which type use here
// $FlowFixMe
stream.end(new Buffer(data.data, 'base64'));
stream.done();
};

View File

@ -28,7 +28,6 @@ export default function(config: Config, auth: IAuth, storage: IStorageHandler) {
route.param('package', validatePackage);
// $FlowFixMe
route.param('filename', validateName);
// $FlowFixMe
route.param('version', validateName);
route.param('anything', match(/.*/));

View File

@ -6,7 +6,6 @@
import assert from 'assert';
import UrlNode from 'url';
import _ from 'lodash';
// $FlowFixMe
import { ErrorCode, isObject, getLatestVersion, tagVersion, validateName } from './utils';
import { generatePackageTemplate, normalizePackage, generateRevision, getLatestReadme, cleanUpReadme, normalizeContributors } from './storage-utils';
import { API_ERROR, DIST_TAGS, STORAGE } from './constants';

View File

@ -145,7 +145,6 @@ export function publishPackage(name: string, metadata: any, localStorage: IStora
export function checkPackageRemote(name: string, isAllowPublishOffline: boolean, syncMetadata: Function): Promise<any> {
return new Promise((resolve, reject) => {
// $FlowFixMe
syncMetadata(name, null, {}, (err, packageJsonLocal, upLinksErrors) => {
// something weird
if (err && err.status !== HTTP_STATUS.NOT_FOUND) {

View File

@ -145,7 +145,6 @@ class Storage implements IStorageHandler {
// local reported 404
let err404 = err;
localStream.abort();
// $FlowFixMe
localStream = null; // we force for garbage collector
self.localStorage.getPackageMetadata(name, (err, info: Package) => {
if (_.isNil(err) && info._distfiles && _.isNil(info._distfiles[filename]) === false) {
@ -182,7 +181,6 @@ class Storage implements IStorageHandler {
let uplink: any = null;
for (let uplinkId in self.uplinks) {
// $FlowFixMe
if (self.uplinks[uplinkId].isUplinkValid(file.url)) {
uplink = self.uplinks[uplinkId];
}
@ -441,7 +439,6 @@ class Storage implements IStorageHandler {
}
if (err || !upLinkResponse) {
// $FlowFixMe
return cb(null, [err || ErrorCode.getInternalError('no data')]);
}

View File

@ -108,7 +108,6 @@ class ProxyStorage implements IProxy {
if (cb) {
cb(ErrorCode.getInternalError(API_ERROR.UPLINK_OFFLINE));
}
// $FlowFixMe
streamRead.emit('error', ErrorCode.getInternalError(API_ERROR.UPLINK_OFFLINE));
});
// $FlowFixMe
@ -297,7 +296,6 @@ class ProxyStorage implements IProxy {
if (_.isNil(tokenConf.token) === false && _.isString(tokenConf.token)) {
token = tokenConf.token;
} else if (_.isNil(tokenConf.token_env) === false) {
// $FlowFixMe
if (_.isString(tokenConf.token_env)) {
token = process.env[tokenConf.token_env];
} else if (_.isBoolean(tokenConf.token_env) && tokenConf.token_env) {
@ -392,7 +390,6 @@ class ProxyStorage implements IProxy {
const getHost = urlDomainParsed => (isHTTPS(urlDomainParsed) ? urlDomainParsed.hostname : urlDomainParsed.host);
const isMatchProtocol: boolean = urlParsed.protocol === this.url.protocol;
const isMatchHost: boolean = getHost(urlParsed) === getHost(this.url);
// $FlowFixMe
const isMatchPath: boolean = urlParsed.path.indexOf(this.url.path) === 0;
return isMatchProtocol && isMatchHost && isMatchPath;

View File

@ -98,7 +98,7 @@ describe('Config Utilities', () => {
// $FlowFixMe
expect(react.access[0]).toBe(ROLES.$ALL);
expect(react.publish).toBeDefined();
// $FlowFixMe);
// $FlowFixMe
expect(react.publish[0]).toBe('admin');
expect(react.proxy).toBeDefined();
// $FlowFixMe