Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
Relevant Package
utils
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
Add ability to provide a regex expression of the type name instead of a string that has to match exactly.
Additionally, allow for a glob pattern to be given as the "path" for theFileSpecifier
.
Fail
// N/A
Pass
// Match all local types prefix with mutabletypeMatchesSpecifier(type,{from:"file",name:/^(M|m)utable.+/u,},program);// Match all local types defined in a test or tests director.typeMatchesSpecifier(type,{from:"file",name:/^.+/u,path:"**/tests?/**"},program);// Match all build in "Readonly" typestypeMatchesSpecifier(type,{from:"lib",name:/^Readonly.+/u,},program);// Match all types in all@foo/* packagestypeMatchesSpecifier(type,{from:"package",name:/^.+/u,package:/^@foo\/.+/u,},program);
Additional Info
New specifier definitions will look something like this:
interfaceFileSpecifier{from:'file';name:string|RegExp|(string|RegExp)[];path?:string;}interfaceLibSpecifier{from:'lib';name:string|RegExp|(string|RegExp)[];}interfacePackageSpecifier{from:'package';name:string|RegExp|(string|RegExp)[];package:string|RegExp;}