Skip to content

Commit

Permalink
feat: throw if contains multiple wildcards (#245)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <[email protected]>
  • Loading branch information
VdustR and antfu authored Nov 25, 2024
1 parent a3f4b31 commit 30daa36
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const services = [
'.gitlab*',
'.gitpod*',
'.sentry*',
'sentry.*.config.ts',
'.stackblitz*',
'.styleci*',
'.travis*',
Expand All @@ -64,6 +63,7 @@ const services = [
'pullapprove*',
'release-tasks.sh',
'renovate*',
'sentry.*.config.ts',
'sonar-project.properties',
'unlighthouse*',
'vercel*',
Expand Down Expand Up @@ -554,6 +554,18 @@ const full = sortObject({
return a.localeCompare(b)
})

/**
* Throw an error if any of the values contain multiple wildcards.
*
* @see https://github.com/antfu/vscode-file-nesting-config/pull/245
*/
Object.entries(full).forEach(([key, value]) => {
const items = value.split(',').map(i => i.trim())
const itemWithMultipleWildcards = items.find(i => i.split('*').length > 2)
if (itemWithMultipleWildcards)
throw new Error(`Multiple wildcards are not allowed, found in ${key}: ${itemWithMultipleWildcards}`)
})

const today = new Date().toISOString().slice(0, 16).replace('T', ' ')

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

0 comments on commit 30daa36

Please sign in to comment.