From 91acb121847018e737c21b367fcaab8baa918347 Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Sat, 28 Dec 2019 19:18:44 +0100 Subject: [PATCH] feat(eslint-config): enable eslint curly (#308) this is disabled by prettier default config and we want it enabled it --- core/file-locking/src/__tests__/lock.spec.ts | 4 +++- plugins/aws-s3-storage/src/s3PackageManager.ts | 7 +++++-- plugins/htpasswd/src/utils.ts | 4 +++- tools/eslint-config/rules/prettier.js | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/file-locking/src/__tests__/lock.spec.ts b/core/file-locking/src/__tests__/lock.spec.ts index 33122a8d..e8d542d2 100644 --- a/core/file-locking/src/__tests__/lock.spec.ts +++ b/core/file-locking/src/__tests__/lock.spec.ts @@ -14,7 +14,9 @@ const getFilePath = (filename: string): string => { const removeTempFile = (filename: string): void => { const filepath = getFilePath(filename); fs.unlink(filepath, error => { - if (error) throw error; + if (error) { + throw error; + } }); }; diff --git a/plugins/aws-s3-storage/src/s3PackageManager.ts b/plugins/aws-s3-storage/src/s3PackageManager.ts index 74c157b7..7e3d147f 100644 --- a/plugins/aws-s3-storage/src/s3PackageManager.ts +++ b/plugins/aws-s3-storage/src/s3PackageManager.ts @@ -121,8 +121,11 @@ export default class S3PackageManager implements ILocalPackageManager { Prefix: `${this.config.keyPrefix}${this.packageName}`, }, function(err) { - if (err && is404Error(err as VerdaccioError)) callback(null); - else callback(err); + if (err && is404Error(err as VerdaccioError)) { + callback(null); + } else { + callback(err); + } } ); } diff --git a/plugins/htpasswd/src/utils.ts b/plugins/htpasswd/src/utils.ts index c48b1bb3..fea59df9 100644 --- a/plugins/htpasswd/src/utils.ts +++ b/plugins/htpasswd/src/utils.ts @@ -33,7 +33,9 @@ export function unlockFile(name: string, cb: Callback): void { export function parseHTPasswd(input: string): Record { return input.split('\n').reduce((result, line) => { const args = line.split(':', 3); - if (args.length > 1) result[args[0]] = args[1]; + if (args.length > 1) { + result[args[0]] = args[1]; + } return result; }, {}); } diff --git a/tools/eslint-config/rules/prettier.js b/tools/eslint-config/rules/prettier.js index 01318340..5052636e 100644 --- a/tools/eslint-config/rules/prettier.js +++ b/tools/eslint-config/rules/prettier.js @@ -1,6 +1,7 @@ module.exports = { extends: ['plugin:prettier/recommended', 'prettier/@typescript-eslint'], rules: { + curly: ['error', 'all'], 'prettier/prettier': [ 'error', {