I am looking to use eslint to force my imports to be in a standard order.
I have got this working, however it leads to a long eslint file as I have many different paths I have TypeScript aliases set up with that I want the eslint rules to exclude when sorting the external packages.
I have it working like this:
"import/order": [
  "error",
  {
    "groups": ["builtin", "external", "internal"],
    "pathGroups": [
      {
        "pattern": "react*",
        "group": "external",
        "position": "before"
      },
      {
        "pattern": "Components/**",
        "group": "internal"
      },
      {
        "pattern": "Constants/**",
        "group": "internal"
      }
      ... more patterns here
    ],
    "pathGroupsExcludedImportTypes": ["react", "internal"],
    "alphabetize": {
      "order": "asc",
      "caseInsensitive": true
    }
  }
],
I was wondering if there was a way to group the patterns, so I could do something more like this:
"import/order": [
  "error",
  {
    "groups": ["builtin", "external", "internal"],
    "pathGroups": [
      {
        "pattern": "react*",
        "group": "external",
        "position": "before"
      },
      {
        "pattern": "Components/**|Constants/**|AnotherAlias/**|AnotherAlias/**",
        "group": "internal"
      }
    ],
    "pathGroupsExcludedImportTypes": ["react", "internal"],
    "alphabetize": {
      "order": "asc",
      "caseInsensitive": true
    }
  }
],
				
                        
The pattern is a minimatch pattern. As you can see using this (I think) unofficial tester, to make the pattern match a string among a set, you should use the set operator:
In your case, then, you can write like this
I'm not sure that this would fix your issue, though. I solved it by properly setting the eslint setting
import/internal-regex. This setting tells eslint, and then the plugin (as you can see here), how to tell if an import is internal. So you could set it: