Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: sort-imports custom-groups Regex match #138

Open
2 tasks done
movahhedi opened this issue Apr 27, 2024 · 0 comments
Open
2 tasks done

Feature: sort-imports custom-groups Regex match #138

movahhedi opened this issue Apr 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@movahhedi
Copy link

What rule do you want to change?

sort-imports

Describe the problem

To match imports in custom groups with Regex (instead of / along with) minimatch.
Because minimatch doesn't support wildcard matching for parent paths. So i have to do something like:

// eslint.config.mjs
const longParentPath =
	"{.," +
	Array.from({ length: 10 }, (_, i) => "../".repeat(i + 1).slice(0, -1)).join(",") +
	"}";

// returns: {.,..,../..,../../..,../../../..,../../../../..,../../../../../..,../../../../../../..,../../../../../../../..,../../../../../../../../..,../../../../../../../../../..}

// ...
"custom-groups": {
	value: {
		"AdmoPro-Basics": `${longParentPath}/Basics/**`,
	},
	type: {
		"AdmoPro-Basics": `${longParentPath}/Basics/**`,
	},
}
// ...

to be able to match:

import { i18n } from "../../../Basics/Language";
// and
import { i18n } from "../../../../../Basics/Language";

and other similar imports in files with various depths.

Code example

Provided.

Additional comments

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@movahhedi movahhedi added the enhancement New feature or request label Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant