Skip to content

Commit

Permalink
fix pattern syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Aug 19, 2024
1 parent e6c42da commit 5c98c9d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/svelte-check/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,26 @@ async function openAllDocuments(
svelteCheck: SvelteCheck
) {
const offset = workspaceUri.fsPath.length + 1;
// We support a very limited subset of glob patterns: You can have a * at the end or the start
// We support a very limited subset of glob patterns: You can only have ** at the end or the start
const ignored: Array<(path: string) => boolean> = filePathsToIgnore.map((i) => {
if (i.endsWith('*')) i = i.slice(0, -1);
if (i.startsWith('*')) {
i = i.slice(1);
if (i.endsWith('**')) i = i.slice(0, -2);

if (i.startsWith('**')) {
i = i.slice(2);

if (i.includes('*'))
throw new Error(
'Invalid svelte-check --ignore pattern: Only * at the start or end is supported'
'Invalid svelte-check --ignore pattern: Only ** at the start or end is supported'
);

return (path) => path.includes(i);
}

if (i.includes('*'))
throw new Error(
'Invalid svelte-check --ignore pattern: Only * at the start or end is supported'
'Invalid svelte-check --ignore pattern: Only ** at the start or end is supported'
);

return (path) => path.startsWith(i);
});
const isIngored = (path: string) => {
Expand Down

0 comments on commit 5c98c9d

Please sign in to comment.