Skip to content

Commit 30daa36

Browse files
VdustRantfu
andauthored
feat: throw if contains multiple wildcards (#245)
Co-authored-by: Anthony Fu <github@antfu.me>
1 parent a3f4b31 commit 30daa36

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

update.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const services = [
5050
'.gitlab*',
5151
'.gitpod*',
5252
'.sentry*',
53-
'sentry.*.config.ts',
5453
'.stackblitz*',
5554
'.styleci*',
5655
'.travis*',
@@ -64,6 +63,7 @@ const services = [
6463
'pullapprove*',
6564
'release-tasks.sh',
6665
'renovate*',
66+
'sentry.*.config.ts',
6767
'sonar-project.properties',
6868
'unlighthouse*',
6969
'vercel*',
@@ -554,6 +554,18 @@ const full = sortObject({
554554
return a.localeCompare(b)
555555
})
556556

557+
/**
558+
* Throw an error if any of the values contain multiple wildcards.
559+
*
560+
* @see https://github.com/antfu/vscode-file-nesting-config/pull/245
561+
*/
562+
Object.entries(full).forEach(([key, value]) => {
563+
const items = value.split(',').map(i => i.trim())
564+
const itemWithMultipleWildcards = items.find(i => i.split('*').length > 2)
565+
if (itemWithMultipleWildcards)
566+
throw new Error(`Multiple wildcards are not allowed, found in ${key}: ${itemWithMultipleWildcards}`)
567+
})
568+
557569
const today = new Date().toISOString().slice(0, 16).replace('T', ' ')
558570

559571
fs.writeFileSync('README.md', fs.readFileSync('README.md', 'utf-8')

0 commit comments

Comments
 (0)