After recently installing the VS Code extension sort-imports
, I decided to give a custom style called import-sort-style-module-alias
a try.
Following what seemed to be the installation instructions (via
npm i import-sort-style-module-alias
) and updating my package.json file with the "importSort"
property, I encountered an issue. Despite restarting VS Code and rebuilding my project, the sort-imports extension refuses to recognize the custom style I've attempted to implement. Default styles continue to work fine.
I'm at a loss as to what step I might be overlooking to make sort-imports
acknowledge the custom style I want to use. My searches on Stack Overflow and Google have revealed no helpful information.
Here is a simplified snippet from my package.json file:
{
"name": "project-name",
"version": "0.0.0",
"scripts": {
...
},
"private": true,
"dependencies": {
...
},
"devDependencies":{
...
},
"importSort": {
".js, .jsx, .es6, .es": {
"parser": "babylon",
"style": "module-alias",
"options": {
"alias": [
"@aliasA",
"@aliasB"
]
}
},
".ts, .tsx": {
"parser": "typescript",
"style": "module-alias",
"options": {
"alias": [
"@aliasA",
"@aliasB"
]
}
}
}
}
Additionally, here is a pared-down version of my tsconfig.json
file:
{
"compileOnSave": false,
"compilerOptions": {
...,
"paths": {
"@aliasA/*": ["projects/appA/src/*"],
"@aliasB/*": ["projects/appB/src/*"]
}
}
}
Update:
Upon discovering the existence of a Sort-Imports
console, it became clear that an error was present:
parser.parseImports is not a function
I am now wondering how best to resolve this error occurring in the Sort-Imports
console.