Skip to content

Commit

Permalink
Remove strict from GlobOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Sep 30, 2019
1 parent 1f2dbd3 commit 9d46b1a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
13 changes: 5 additions & 8 deletions fs/glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ type FileInfo = Deno.FileInfo;
export interface GlobOptions {
extended?: boolean;
globstar?: boolean;
strict?: boolean;
}

export interface GlobToRegExpOptions extends GlobOptions {
Expand Down Expand Up @@ -43,7 +42,7 @@ export function globToRegExp(
glob: string,
options: GlobToRegExpOptions = {}
): RegExp {
const result = globrex(glob, { ...options, filepath: true });
const result = globrex(glob, { ...options, strict: false, filepath: true });
return result.path!.regex;
}

Expand Down Expand Up @@ -118,13 +117,12 @@ export async function* expandGlob(
exclude = [],
includeDirs = true,
extended = false,
globstar = false,
strict = false
globstar = false
}: ExpandGlobOptions = {}
): AsyncIterableIterator<WalkInfo> {
const resolveFromRoot = (path: string): string =>
isAbsolute(path) ? normalize(path) : join(root, path);
const globOptions: GlobOptions = { extended, globstar, strict };
const globOptions: GlobOptions = { extended, globstar };
const excludePatterns = exclude
.map(resolveFromRoot)
.map((s: string): RegExp => globToRegExp(s, globOptions));
Expand Down Expand Up @@ -213,13 +211,12 @@ export function* expandGlobSync(
exclude = [],
includeDirs = true,
extended = false,
globstar = false,
strict = false
globstar = false
}: ExpandGlobOptions = {}
): IterableIterator<WalkInfo> {
const resolveFromRoot = (path: string): string =>
isAbsolute(path) ? normalize(path) : join(root, path);
const globOptions: GlobOptions = { extended, globstar, strict };
const globOptions: GlobOptions = { extended, globstar };
const excludePatterns = exclude
.map(resolveFromRoot)
.map((s: string): RegExp => globToRegExp(s, globOptions));
Expand Down
3 changes: 1 addition & 2 deletions fs/glob_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ const EG_OPTIONS: ExpandGlobOptions = {
root: urlToFilePath(new URL(join("testdata", "glob"), import.meta.url)),
includeDirs: true,
extended: false,
globstar: false,
strict: false
globstar: false
};

test(async function expandGlobWildcard(): Promise<void> {
Expand Down
3 changes: 1 addition & 2 deletions prettier/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,7 @@ async function* getTargetFiles(
exclude,
includeDirs: true,
extended: true,
globstar: true,
strict: false
globstar: true
};

async function* expandDirectory(d: string): AsyncIterableIterator<WalkInfo> {
Expand Down
3 changes: 1 addition & 2 deletions testing/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ export async function* findTestModules(
exclude: excludePaths,
includeDirs: true,
extended: true,
globstar: true,
strict: false
globstar: true
};

async function* expandDirectory(d: string): AsyncIterableIterator<string> {
Expand Down

0 comments on commit 9d46b1a

Please sign in to comment.