Repository metrics
- Stars
- (51 stars)
- PR merge metrics
- (PR metrics pending)
Description
Is your feature request related to a problem? Please describe.
I'm using some import aliases in my tsconfig.json. My project is broken up into a "shared" alias, and subprojects. It's not exactly a monorepo since there's only one package.json, but functionally, this is intended to be a project that includes some sample games using a library.
Currently, to manually ensure the "shared" aliases are sorted higher, you have to either manually exclude or manually include folders, which is somewhat more brittle (see below).
While this approach works, I'd rather set up rules based on the real import path, not the aliased paths
Describe the solution you'd like
With this in my tsconfig.json:
"paths": {
"@/*": [
"./reactCommon/*",
"./reactCommon/shared/*"
],
"@/tictactoe/*": [
"./TicTacToe/react/*"
]
}
I'd like to be able to do something like this:
{
"groupRules": [
...,
{},
{
"useTsConfigAliases": true,
"regex": "./reactCommon"
},
"^[@]"
or alternatively
{
"groupRules": [
...,
{},
{
"regex": "^[@]",
"sortRules": {
"paths": [{"aliased": "./reactCommon"}, "_", "aA"]
}
}
Describe alternatives you've considered
{
"groupRules": [
...,
{},
"^[@]/((?!tictactoe).)*$",
"^[@]/tictactoe",
or
{
"groupRules": [
...,
{},
"^[@]/(app|components|public|shared)"
"^[@]/tictactoe",
I also could differentiate the aliases (e.g. @/ and #/ or something), but I'd prefer not to do that.
Additional context
My goal is to sort anything that's in the reactCommon folder higher than anything that's specific to anything specific to an individual game, without having to manually specify either the names of the games or the names of the folders under reactCommon
As things are now, without those explicit folder mentions, when it sees @/util and @/tictactoe, it ends up sorting the imports alphabetically rather than grouping them by "is this shared sample code or sample code specific to one game?"