From bff84dbca25cacc052d02d8324f394f47cb07be9 Mon Sep 17 00:00:00 2001 From: Yao Ding Date: Wed, 27 Jan 2021 20:13:57 -0500 Subject: [PATCH] fix: remove empty keys from config key check (#3105) * fix: remove empty keys from config key check close #3104 * Update packages/config/src/index.ts Co-authored-by: Zoltan Kochan Co-authored-by: Zoltan Kochan --- .changeset/proud-lies-shout.md | 5 +++++ packages/config/src/index.ts | 2 +- packages/config/test/index.ts | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/proud-lies-shout.md diff --git a/.changeset/proud-lies-shout.md b/.changeset/proud-lies-shout.md new file mode 100644 index 0000000000..0c7fca9f03 --- /dev/null +++ b/.changeset/proud-lies-shout.md @@ -0,0 +1,5 @@ +--- +"@pnpm/config": patch +--- + +fix: remove empty keys from config key check diff --git a/packages/config/src/index.ts b/packages/config/src/index.ts index 3b784b75f2..50a8bf79e2 100644 --- a/packages/config/src/index.ts +++ b/packages/config/src/index.ts @@ -395,7 +395,7 @@ export default async ( const settingKeys = Object.keys({ ...npmConfig?.sources?.workspace?.data, ...npmConfig?.sources?.project?.data, - }) + }).filter(key => key.trim() !== '') const unknownKeys = [] for (const key of settingKeys) { if (!rcOptions.includes(key) && !key.startsWith('//') && !(key.startsWith('@') && key.endsWith(':registry'))) { diff --git a/packages/config/test/index.ts b/packages/config/test/index.ts index 391da5f33c..68d2bf4300 100644 --- a/packages/config/test/index.ts +++ b/packages/config/test/index.ts @@ -634,6 +634,7 @@ test('warn user unknown settings in npmrc', async () => { process.chdir(tmp) const npmrc = [ 'typo-setting=true', + ' ', 'mistake-setting=false', '//foo.bar:_authToken=aaa', '@qar:registry=https://registry.example.org/',