-
Lazy day in the resort, working a little bit on shiba swag store. doing import stuff like setting up eslint for import ordering sarcasm . But finally have some down time revisit the eslint docs for
import/order
-
I want to have react and next libs grouped at the top, node modules , internal modules, then relative files in spaced groups. I’ve kinda got it working with the following eslint config:
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
"import/no-cycle": [1, { "maxDepth": 1 }],
"import/order":[
"error",
{
"groups": [ "external", "builtin" , "internal", "sibling","index" , "type" ],
"pathGroups":[{
"pattern": "{react,next,next/**}",
"position": "before",
"group": "external"
}
],
"pathGroupsExcludedImportTypes": [],
"newlines-between": "always"
}
]
}
- The key part of the config pathGroups which takes a
minimap expression
. not something I’ve heard of before , but this minimap cheatsheet was useful.