Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat(typescript-estree): replaceglobby
w/fast-glob
#9518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import debug from 'debug'; | ||
import { sync as globSync } from 'fast-glob'; | ||
import isGlob from 'is-glob'; | ||
import type { CanonicalPath } from '../create-program/shared'; | ||
@@ -56,15 +56,15 @@ export function resolveProjectList( | ||
const projectFolderIgnoreList = ( | ||
options.projectFolderIgnoreList ?? ['**/node_modules/**'] | ||
).reduce<string[]>((acc, folder) => { | ||
if (typeof folder === 'string') { | ||
acc.push( | ||
// prefix with a ! for not match glob | ||
folder.startsWith('!') ? folder : `!${folder}`, | ||
); | ||
} | ||
return acc; | ||
}, []); | ||
Comment on lines +59 to +67 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. A bonus change, replace the | ||
const cacheKey = getHash({ | ||
project: sanitizedProjects, | ||
@@ -93,16 +93,23 @@ export function resolveProjectList( | ||
const nonGlobProjects = sanitizedProjects.filter(project => !isGlob(project)); | ||
const globProjects = sanitizedProjects.filter(project => isGlob(project)); | ||
let globProjectPaths: string[] = []; | ||
if (globProjects.length > 0) { | ||
// Although fast-glob supports multiple patterns, fast-glob returns arbitrary order of results | ||
// to improve performance. To ensure the order is correct, we need to call fast-glob for each pattern | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. OOC, does the order matter? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. There is a unit test case against the order, so yes, it does matter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. But why does the order matter? Shouldn't the unit test just check that the needed files are linted? Member
| ||
// separately and then concatenate the results in patterns' order. | ||
globProjectPaths = globProjects.flatMap(pattern => | ||
globSync(pattern, { | ||
cwd: options.tsconfigRootDir, | ||
ignore: projectFolderIgnoreList, | ||
}), | ||
); | ||
} | ||
const uniqueCanonicalProjectPaths = new Map( | ||
nonGlobProjects | ||
.concat(globProjectPaths) | ||
.map(project => [ | ||
getCanonicalFileName( | ||
ensureAbsolutePath(project, options.tsconfigRootDir), | ||
Uh oh!
There was an error while loading.Please reload this page.