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/',