From e83e500b802bae5521bffbddd7d5410414daacd9 Mon Sep 17 00:00:00 2001 From: Juan Picado Date: Tue, 27 Oct 2020 10:18:59 +0100 Subject: [PATCH] fix: cleanup warnings (#1986) * fix: lint warnings * fix: test --- .eslintrc | 31 +++++++++++-------- packages/api/src/publish.ts | 1 - .../logger-prettify/test/formatter.spec.ts | 10 ------ .../active-directory/src/active-directory.ts | 1 + packages/plugins/auth-memory/src/Memory.ts | 22 +++---------- .../plugins/auth-memory/test/index.spec.ts | 10 +++--- .../aws-storage/src/s3PackageManager.ts | 12 ++++--- .../aws-storage/tests/__fixtures__/pkg.ts | 19 ++++++++++-- .../plugins/aws-storage/tests/index.test.ts | 3 +- .../tests/s3PackageManager.test.ts | 3 +- .../tests/s3PackageManagerMockedS3.test.ts | 6 ++-- .../google-cloud-storage/src/data-storage.ts | 6 ++-- .../src/storage-helper.ts | 6 ++-- .../google-cloud-storage/src/storage.ts | 9 ++++-- packages/plugins/memory/src/memory-handler.ts | 6 ++-- packages/proxy/src/up-storage.ts | 1 - packages/server/test/token/index.spec.ts | 2 ++ packages/store/src/storage-utils.ts | 1 - test/e2e-cli/utils/registry.ts | 3 +- 19 files changed, 80 insertions(+), 72 deletions(-) diff --git a/.eslintrc b/.eslintrc index 03bbb0741..89b465a70 100644 --- a/.eslintrc +++ b/.eslintrc @@ -43,22 +43,21 @@ "jest/no-test-callback": 0, "jest/expect-expect": 0, "jest/no-try-expect": 0, - "jest/no-identical-title": 1, "keyword-spacing": "off", "no-tabs": "off", "no-useless-escape": "off", "padded-blocks": "off", "require-jsdoc": "off", "valid-jsdoc": "off", - "import/order": ["warn"], - "eol-last": "warn", - "no-irregular-whitespace": "warn", - "no-mixed-spaces-and-tabs": ["warn", "smart-tabs"], - "no-trailing-spaces": "warn", + "import/order": ["error"], + "eol-last": "error", + "no-irregular-whitespace": "error", + "no-mixed-spaces-and-tabs": ["error", "smart-tabs"], + "no-trailing-spaces": "error", "camelcase": "off", "guard-for-in": "error", "new-cap": "error", - "max-len": ["warn", 100], + "max-len": ["error", 100], "no-console": ["error", { "allow": ["warn"] }], "no-constant-condition": "error", "no-debugger": "error", @@ -68,14 +67,12 @@ "no-new-require": "error", "no-undef": "error", "no-unreachable": "error", - "no-unused-vars": ["warn", { "vars": "all", "args": "none" }], "no-var": "error", "one-var": "error", - "prefer-rest-params": "warn", - "prefer-spread": "warn", + "prefer-rest-params": "error", + "prefer-spread": "error", "handle-callback-err": 0, "prefer-const": 0, - "prefer-promise-reject-errors": 1, "@typescript-eslint/camelcase": 0, "@typescript-eslint/ban-ts-ignore": 0, "@typescript-eslint/no-var-requires": 0, @@ -83,13 +80,21 @@ "@typescript-eslint/no-empty-function": 0, "@typescript-eslint/no-this-alias": 0, "@typescript-eslint/no-use-before-define": 0, - "@typescript-eslint/array-type": ["warn"], + "@typescript-eslint/array-type": ["error"], "@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/indent": 0, "@typescript-eslint/ban-ts-comment": 0, "@typescript-eslint/ban-types": 0, "@typescript-eslint/explicit-module-boundary-types": 0, + + // rules to fix + "no-unused-vars": ["warn", { "vars": "all", "args": "none" }], + "jest/no-identical-title": ["warn"], + "prefer-promise-reject-errors": ["warn"], + "jest/no-disabled-tests": ["warn"], + "jest/no-commented-out-tests": ["warn"], + "@typescript-eslint/prefer-optional-chain": ["warn"], "@typescript-eslint/explicit-member-accessibility": ["warn"], - "@typescript-eslint/prefer-optional-chain": ["warn"] + "@typescript-eslint/no-unused-vars": ["warn"] } } diff --git a/packages/api/src/publish.ts b/packages/api/src/publish.ts index cda62c1da..5b5ff6cd7 100644 --- a/packages/api/src/publish.ts +++ b/packages/api/src/publish.ts @@ -216,7 +216,6 @@ export function publishPackage(storage: IStorageHandler, config: Config, auth: I /** * npm-registry-client 0.3+ embeds tarball into the json upload - * https://github.com/isaacs/npm-registry-client/commit/e9fbeb8b67f249394f735c74ef11fe4720d46ca0 * issue https://github.com/rlidwka/sinopia/issues/31, dealing with it here: */ diff --git a/packages/logger-prettify/test/formatter.spec.ts b/packages/logger-prettify/test/formatter.spec.ts index 8717a8e55..a22eba88c 100644 --- a/packages/logger-prettify/test/formatter.spec.ts +++ b/packages/logger-prettify/test/formatter.spec.ts @@ -171,16 +171,6 @@ describe('formatter', () => { expect(printMessage(log, prettyfierOptions)).toMatchSnapshot(); }); - // test('should handle undefined object', () => { - // const log = { - // level: 15, - // something: 'foo', - // msg: 'custom - @{something} - @{missingParam}' - // }; - // - // expect(printMessage(undefined, undefined, undefined)).toMatchSnapshot(); - // }); - test('should display a resource request', () => { const log = { level: 30, diff --git a/packages/plugins/active-directory/src/active-directory.ts b/packages/plugins/active-directory/src/active-directory.ts index 4b58e3c8b..1e826c533 100644 --- a/packages/plugins/active-directory/src/active-directory.ts +++ b/packages/plugins/active-directory/src/active-directory.ts @@ -63,6 +63,7 @@ class ActiveDirectoryPlugin implements IPluginAuth { ); if (matchingGroups.length <= 0) { + // eslint-disable-next-line max-len const notMemberMessage = `AD - User ${user} is not member of group(s): ${requestedGroups.join( ', ' )}`; diff --git a/packages/plugins/auth-memory/src/Memory.ts b/packages/plugins/auth-memory/src/Memory.ts index 2efa89f09..cfb463e87 100644 --- a/packages/plugins/auth-memory/src/Memory.ts +++ b/packages/plugins/auth-memory/src/Memory.ts @@ -8,7 +8,7 @@ import { } from '@verdaccio/types'; import { getConflict, getForbidden, getNotFound, getUnauthorized } from '@verdaccio/commons-api'; -import { VerdaccioMemoryConfig, Users, UserMemory } from './types/index'; +import { VerdaccioMemoryConfig, Users, UserMemory } from './types'; export default class Memory implements IPluginAuth { public _logger: Logger; @@ -91,10 +91,7 @@ export default class Memory implements IPluginAuth { } public allow_access(user: RemoteUser, pkg: PackageAccess, cb: Callback): void { - if ( - (pkg.access && pkg.access.includes('$all')) || - (pkg.access && pkg.access.includes('$anonymous')) - ) { + if (pkg?.access?.includes('$all') || pkg?.access?.includes('$anonymous')) { this._logger.debug( { user: user.name }, '[VerdaccioMemory] user: @{user} has been granted access' @@ -109,10 +106,7 @@ export default class Memory implements IPluginAuth { return cb(err); } - if ( - (pkg.access && pkg.access.includes(user.name)) || - (pkg.access && pkg.access.includes('$authenticated')) - ) { + if (pkg?.access?.includes(user.name) || pkg?.access?.includes('$authenticated')) { this._logger.debug( { user: user.name }, '[VerdaccioMemory] user: @{user} has been granted access' @@ -130,10 +124,7 @@ export default class Memory implements IPluginAuth { } public allow_publish(user: RemoteUser, pkg: PackageAccess, cb: Callback): void { - if ( - (pkg.publish && pkg.publish.includes('$all')) || - (pkg.publish && pkg.publish.includes('$anonymous')) - ) { + if (pkg?.publish?.includes('$all') || pkg?.publish?.includes('$anonymous')) { this._logger.debug( { user: user.name }, '[VerdaccioMemory] user: @{user} has been granted to publish' @@ -148,10 +139,7 @@ export default class Memory implements IPluginAuth { return cb(err); } - if ( - (pkg.publish && pkg.publish.includes(user.name)) || - (pkg.publish && pkg.publish.includes('$authenticated')) - ) { + if (pkg?.publish?.includes(user.name) || pkg?.publish?.includes('$authenticated')) { return cb(null, true); } diff --git a/packages/plugins/auth-memory/test/index.spec.ts b/packages/plugins/auth-memory/test/index.spec.ts index ba6f899c7..77494c601 100644 --- a/packages/plugins/auth-memory/test/index.spec.ts +++ b/packages/plugins/auth-memory/test/index.spec.ts @@ -61,7 +61,7 @@ describe('Memory', function () { describe('replace user', function () { beforeAll(function (done) { - auth.adduser('test', 'secret', function (_err) { + auth.adduser('test', 'secret', function () { done(); }); }); @@ -80,7 +80,7 @@ describe('Memory', function () { describe('#allow_access', function () { beforeEach(function (done) { - auth.adduser('test', 'secret', function (_err, _user) { + auth.adduser('test', 'secret', function () { done(); }); }); @@ -136,7 +136,7 @@ describe('Memory', function () { describe('#allow_publish', function () { beforeEach(function (done) { - auth.adduser('test', 'secret', function (_err, _user) { + auth.adduser('test', 'secret', function () { done(); }); }); @@ -198,7 +198,7 @@ describe('Memory', function () { config: {} as VerdaccioMemoryConfig, logger, }); - auth.adduser('test', 'secret', function (_err, _user) { + auth.adduser('test', 'secret', function () { done(); }); }); @@ -222,7 +222,7 @@ describe('Memory', function () { describe('#authenticate', function () { beforeEach(function (done) { - auth.adduser('test', 'secret', function (_err, _user) { + auth.adduser('test', 'secret', function () { done(); }); }); diff --git a/packages/plugins/aws-storage/src/s3PackageManager.ts b/packages/plugins/aws-storage/src/s3PackageManager.ts index a9d5436d3..a39a8a782 100644 --- a/packages/plugins/aws-storage/src/s3PackageManager.ts +++ b/packages/plugins/aws-storage/src/s3PackageManager.ts @@ -283,7 +283,8 @@ export default class S3PackageManager implements ILocalPackageManager { Key: `${this.packagePath}/${name}`, }; - // NOTE: I'm using listObjectVersions so I don't have to download the full object with getObject. + // NOTE: I'm using listObjectVersions so I don't have to download the + // full object with getObject. // Preferably, I'd use getObjectMetadata or getDetails when it's available in the node sdk // TODO: convert to headObject this.s3.headObject( @@ -321,7 +322,8 @@ export default class S3PackageManager implements ILocalPackageManager { const error: HttpError = convertS3Error(err); this.logger.error( { error: error.message }, - 's3: [S3PackageManager writeTarball managedUpload send] emit error @{error}' + `s3: [S3PackageManager writeTarball managedUpload send] + emit error @{error}` ); uploadStream.emit('error', error); @@ -369,7 +371,8 @@ export default class S3PackageManager implements ILocalPackageManager { } else { this.logger.trace( { name }, - 's3: [S3PackageManager writeTarball uploadStream] streamEnded false emit end @{name}' + `s3: [S3PackageManager writeTarball uploadStream] streamEnded + false emit end @{name}` ); uploadStream.on('end', onEnd); } @@ -391,7 +394,8 @@ export default class S3PackageManager implements ILocalPackageManager { } finally { this.logger.debug( { name, baseS3Params }, - 's3: [S3PackageManager writeTarball uploadStream abort] s3.deleteObject @{name}/@baseS3Params' + `s3: [S3PackageManager writeTarball uploadStream abort] + s3.deleteObject @{name}/@baseS3Params` ); this.s3.deleteObject(baseS3Params); diff --git a/packages/plugins/aws-storage/tests/__fixtures__/pkg.ts b/packages/plugins/aws-storage/tests/__fixtures__/pkg.ts index c0312a70f..9782c6780 100644 --- a/packages/plugins/aws-storage/tests/__fixtures__/pkg.ts +++ b/packages/plugins/aws-storage/tests/__fixtures__/pkg.ts @@ -36,7 +36,8 @@ const json: Package = { }, dist: { integrity: - 'sha512-6gHiERpiDgtb3hjqpQH5/i7zRmvYi9pmCjQf2ZMy3QEa9wVk9RgdZaPWUt7ZOnWUPFjcr9cmE6dUBf+XoPoH4g==', + 'sha512-6gHiERpiDgtb3hjqpQH5/i7zRmvYi9pmCjQ' + + 'f2ZMy3QEa9wVk9RgdZaPWUt7ZOnWUPFjcr9cmE6dUBf+XoPoH4g==', shasum: '2c03764f651a9f016ca0b7620421457b619151b9', tarball: 'http://localhost:5555/@scope/pk1-test/-/@scope/pk1-test-1.0.6.tgz', }, @@ -47,7 +48,21 @@ const json: Package = { '@scope/pk1-test-1.0.6.tgz': { content_type: 'application/octet-stream', data: - 'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlocNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IOvurLuz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8nVbVqMR4OsNoVB66kF1aW8eML+Vv10m9oF/jP6IfY4QyyTrILlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CRjx0ScCdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUKDiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y7vJrtLC1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7Sxp7ff3nbt6TBFy65gK1iffsN41yoEHtdFbOiisWMH8bPvXUH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/agIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhhQ6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=', + 'H4sIAAAAAAAAE+2W32vbMBDH85y/QnjQp9qxLEeBMsbGlo' + + 'cNBmN7bFdQ5WuqxJaEpGQdo//79KPeQsnIw5KUDX/9IOvur' + + 'Luz/DHSjK/YAiY6jcXSKjk6sMqypHWNdtmD6hlBI0wqQmo8n' + + 'VbVqMR4OsNoVB66kF1aW8eML+Vv10m9oF/jP6IfY4QyyTrI' + + 'LlD2eqkcm+gVzpdrJrPz4NuAsULJ4MZFWdBkbcByI7R79CR' + + 'jx0ScCdnAvf+SkjUFWu8IubzBgXUhDPidQlfZ3BhlLpBUK' + + 'DiQ1cDFrYDmKkNnZwjuhUM4808+xNVW8P2bMk1Y7vJrtLC' + + '1u1MmLPjBF40+Cc4ahV6GDmI/DWygVRpMwVX3KtXUCg7S' + + 'xp7ff3nbt6TBFy65gK1iffsN41yoEHtdFbOiisWMH8bPvX' + + 'UH0SP3k+KG3UBr+DFy7OGfEJr4x5iWVeS/pLQe+D+FIv/a' + + 'gIWI6GX66kFuIhT+1gDjrp/4d7WAvAwEJPh0u14IufWkM0' + + 'zaW2W6nLfM2lybgJ4LTJ0/jWiAK8OcMjt8MW3OlfQppcuhh' + + 'Q6k+2OgkK2Q8DssFPi/IHpU9fz3/+xj5NjDf8QFE39VmE4' + + 'JDfzPCBn4P4X6/f88f/Pu47zomiPk2Lv/dOv8h+P/34/D/' + + 'p9CL+Kp67mrGDRo0KBBp9ZPsETQegASAAA=', length: 512, }, }, diff --git a/packages/plugins/aws-storage/tests/index.test.ts b/packages/plugins/aws-storage/tests/index.test.ts index b36d808be..bfbf987bc 100644 --- a/packages/plugins/aws-storage/tests/index.test.ts +++ b/packages/plugins/aws-storage/tests/index.test.ts @@ -43,7 +43,8 @@ describe.skip('Local Database', () => { reject(err); return; } - expect(data.IsTruncated).toBe(false); // none of the tests we do should create this much data + // none of the tests we do should create this much data + expect(data.IsTruncated).toBe(false); // remove the stuff that changes from the results expect( data.Contents.map(({ Key, Size }) => ({ diff --git a/packages/plugins/aws-storage/tests/s3PackageManager.test.ts b/packages/plugins/aws-storage/tests/s3PackageManager.test.ts index ffad52f55..26dba17cc 100644 --- a/packages/plugins/aws-storage/tests/s3PackageManager.test.ts +++ b/packages/plugins/aws-storage/tests/s3PackageManager.test.ts @@ -38,7 +38,8 @@ describe.skip('S3 package manager', () => { reject(err); return; } - expect(data.IsTruncated).toBe(false); // none of the tests we do should create this much data + // none of the tests we do should create this much data + expect(data.IsTruncated).toBe(false); // remove the stuff that changes from the results expect( data.Contents.map(({ Key, Size }) => ({ diff --git a/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts b/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts index 7bb9c9291..9da1df36f 100644 --- a/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts +++ b/packages/plugins/aws-storage/tests/s3PackageManagerMockedS3.test.ts @@ -109,7 +109,7 @@ describe('S3PackageManager with mocked s3', function () { }); }); - test('new package is uploaded to custom storage prefix as specified on package section in config', (done) => { + test('new package is uploaded to custom storage prefix', (done) => { expect.assertions(2); const config: S3Config = { bucket: 'test-bucket', @@ -340,7 +340,7 @@ describe('S3PackageManager with mocked s3', function () { getMatchedPackagesSpec: jest.fn(() => null) as PackageAccess, } as S3Config; - mockGetObject.mockImplementation((params) => { + mockGetObject.mockImplementation(() => { return { on: jest.fn(() => ({ createReadStream: jest.fn(() => ({ @@ -371,7 +371,7 @@ describe('S3PackageManager with mocked s3', function () { })) as PackageAccess, } as S3Config; - mockGetObject.mockImplementation((params) => { + mockGetObject.mockImplementation(() => { return { on: jest.fn(() => ({ createReadStream: jest.fn(() => ({ diff --git a/packages/plugins/google-cloud-storage/src/data-storage.ts b/packages/plugins/google-cloud-storage/src/data-storage.ts index 63d7abab4..7fe2f34d8 100644 --- a/packages/plugins/google-cloud-storage/src/data-storage.ts +++ b/packages/plugins/google-cloud-storage/src/data-storage.ts @@ -63,7 +63,8 @@ class GoogleCloudDatabase implements IPluginStorage { - // if (typeof deletedItems === 'undefined' || deletedItems.length === 0 || deletedItems[0][0].indexUpdates === 0) { + // if (typeof deletedItems === 'undefined' || deletedItems.length === 0 + // || deletedItems[0][0].indexUpdates === 0) { // return getNotFound('trying to remove a package that does not exist'); // } else if (deletedItems[0][0].indexUpdates > 0) { // return null; diff --git a/packages/plugins/google-cloud-storage/src/storage-helper.ts b/packages/plugins/google-cloud-storage/src/storage-helper.ts index 6476bb47d..0e0a310ec 100644 --- a/packages/plugins/google-cloud-storage/src/storage-helper.ts +++ b/packages/plugins/google-cloud-storage/src/storage-helper.ts @@ -48,7 +48,8 @@ export default class StorageHelper implements IStorageHelper { return result; } - // public async updateEntity(key: string, excludeFromIndexes: any, data: any): Promise { + // public async updateEntity(key: string, excludeFromIndexes: any, data: any): + // Promise { // const entity = { // key, // excludeFromIndexes, @@ -83,7 +84,8 @@ export default class StorageHelper implements IStorageHelper { * An entity has one or more named properties, each of which can have one or more values. * Entities of the same kind do not need to have the same properties, * and an entity's values for a given property do not all need to be of the same data type. - * (If necessary, an application can establish and enforce such restrictions in its own data model.) + * (If necessary, an application can establish and enforce such + * restrictions in its own data model.) * https://cloud.google.com/datastore/docs/concepts/entities * @param key */ diff --git a/packages/plugins/google-cloud-storage/src/storage.ts b/packages/plugins/google-cloud-storage/src/storage.ts index 3e9cfd49f..d23810e9f 100644 --- a/packages/plugins/google-cloud-storage/src/storage.ts +++ b/packages/plugins/google-cloud-storage/src/storage.ts @@ -204,9 +204,12 @@ class GoogleCloudStorageHandler implements IPackageStorageManager { await file.save(this._convertToString(metadata), { validation: this.config.validation || defaultValidation, /** - * When resumable is `undefined` - it will default to `true`as per GC Storage documentation: - * `Resumable uploads are automatically enabled and must be shut off explicitly by setting options.resumable to false` - * @see https://cloud.google.com/nodejs/docs/reference/storage/2.5.x/File#createWriteStream + * When resumable is `undefined` - it will default to `true`as + * per GC Storage documentation: + * `Resumable uploads are automatically enabled and must be shut + * off explicitly by setting options.resumable to false` + * @see + * https://cloud.google.com/nodejs/docs/reference/storage/2.5.x/File#createWriteStream */ resumable: this.config.resumable, }); diff --git a/packages/plugins/memory/src/memory-handler.ts b/packages/plugins/memory/src/memory-handler.ts index 4e860a9ca..41a219e4c 100644 --- a/packages/plugins/memory/src/memory-handler.ts +++ b/packages/plugins/memory/src/memory-handler.ts @@ -86,9 +86,7 @@ class MemoryHandler implements IPackageStorageManager { public savePackage(name: string, value: Package, cb: CallbackAction): void { try { - const json: string = stringifyPackage(value); - - this.data[name] = json; + this.data[name] = stringifyPackage(value); return cb(null); } catch (err) { return cb(getInternalError(err.message)); @@ -160,7 +158,7 @@ class MemoryHandler implements IPackageStorageManager { try { const readStream = fs.createReadStream(pathName); - const contentLength: number = (fs.data[name] && fs.data[name].length) || 0; + const contentLength: number = fs?.data[name]?.length || 0; readTarballStream.emit('content-length', contentLength); readTarballStream.emit('open'); readStream.pipe(readTarballStream); diff --git a/packages/proxy/src/up-storage.ts b/packages/proxy/src/up-storage.ts index 2351ce28c..d4787f6f5 100644 --- a/packages/proxy/src/up-storage.ts +++ b/packages/proxy/src/up-storage.ts @@ -90,7 +90,6 @@ class ProxyStorage implements IProxy { public upname: string; // FIXME: proxy can be boolean or object, something smells here // @ts-ignore - // any due this https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#operands-for-delete-must-be-optional public proxy: any; // @ts-ignore public last_request_time: number | null; diff --git a/packages/server/test/token/index.spec.ts b/packages/server/test/token/index.spec.ts index 9e6df9696..4591c2b48 100644 --- a/packages/server/test/token/index.spec.ts +++ b/packages/server/test/token/index.spec.ts @@ -38,6 +38,7 @@ const generateTokenCLI = async (app, token, payload): Promise => { .expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET) .end(function (err, resp) { if (err) { + // eslint-disable-next-line prefer-promise-reject-errors return reject([err, resp]); } resolve([err, resp]); @@ -54,6 +55,7 @@ const deleteTokenCLI = async (app, token, tokenToDelete): Promise => { .expect(HEADER_TYPE.CONTENT_TYPE, HEADERS.JSON_CHARSET) .end(function (err, resp) { if (err) { + // eslint-disable-next-line prefer-promise-reject-errors return reject([err, resp]); } resolve([err, resp]); diff --git a/packages/store/src/storage-utils.ts b/packages/store/src/storage-utils.ts index d5ffa75b2..2ef0fc87f 100644 --- a/packages/store/src/storage-utils.ts +++ b/packages/store/src/storage-utils.ts @@ -90,7 +90,6 @@ export function getLatestReadme(pkg: Package): string { // FIXME: type any due this export function cleanUpReadme(version: any): Version { if (isNil(version) === false) { - // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#operands-for-delete-must-be-optional delete version.readme; } diff --git a/test/e2e-cli/utils/registry.ts b/test/e2e-cli/utils/registry.ts index 94b9cd9e5..b10964fc0 100644 --- a/test/e2e-cli/utils/registry.ts +++ b/test/e2e-cli/utils/registry.ts @@ -1,7 +1,6 @@ +/* eslint-disable prefer-promise-reject-errors */ import { fork } from 'child_process'; -export function prepareEnvironment(rootFolder: string, folderName: string) {} - export function spawnRegistry(verdaccioPath: string, args: string[], childOptions) { return new Promise((resolve, reject) => { let _childOptions = { silent: true, ...childOptions };