-
Notifications
You must be signed in to change notification settings - Fork 71
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
Explore configuration with real regex instead of strings #165
Comments
regex literals would be cool. To solve your first problem I've been using 'simple-import-sort/imports': [
'error',
{
groups: [
// react, react-native, and side effect imports.
['^react$', '^react-native$', String.raw`^\u0000`],
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
[String.raw`^@?\w`],
// Anything starting with a tilde. Anything starting with a dot.
['^~/', String.raw`^\.`],
// type imports
[String.raw`^@?\w.*\u0000$`, String.raw`^[^.].*\u0000$`, String.raw`^\..*\u0000$`],
],
}, It's maybe slightly more readable and done via another eslint rule so I don't really have to think about it. 😛 |
In my experience, regex literal works for both flat config and eslintrc.
|
Now that ESLint 9 is here with Flat config written in JavaScript, it would be cool if it was possible to use regex literals instead of string literals when configuring this plugin.
Pros:
/\w/
instead of"\\w"
.i
for case in-sensitive.What needs to be done:
Example (the default groups):
The text was updated successfully, but these errors were encountered: