-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript-estree): add maximumDefaultProjectFileMatchCount and …
…wide allowDefaultProjectForFiles glob restrictions (#8925) * feat(typescript-estree): add maximumDefaultProjectFileMatchCount * lil touchup for the asterisk * Spelling and Windows normalization * Also reset new cache in persistentParse.test.ts
- Loading branch information
1 parent
4bed24d
commit 3fd666f
Showing
15 changed files
with
273 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/typescript-estree/src/create-program/validateDefaultProjectForFilesGlob.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { ProjectServiceOptions } from '../parser-options'; | ||
|
||
export const DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = ` | ||
Having many files run with the default project is known to cause performance issues and slow down linting. | ||
See https://typescript-eslint.io/troubleshooting/#allowdefaultprojectforfiles-glob-too-wide | ||
`; | ||
|
||
export function validateDefaultProjectForFilesGlob( | ||
options: ProjectServiceOptions, | ||
): void { | ||
if (!options.allowDefaultProjectForFiles?.length) { | ||
return; | ||
} | ||
|
||
for (const glob of options.allowDefaultProjectForFiles) { | ||
if (glob === '*') { | ||
throw new Error( | ||
`allowDefaultProjectForFiles contains the overly wide '*'.${DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}`, | ||
); | ||
} | ||
if (glob.includes('**')) { | ||
throw new Error( | ||
`allowDefaultProjectForFiles glob '${glob}' contains a disallowed '**'.${DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}`, | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.