You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Format file with prettier-eslint plugin fails to correctly order the import statements, and gives this error below:
Unable to resolve path to module '@/utils.ts'
Where @ is some path alias defined in the project's tsconfig.json file.
Reason
After debugging line by line of eslint, I finaly got that it is the eslint-import-resolver-typescript plugin which cannot parse the import path with an alias.
The plugin is set default to resolve the project config file with path '/tsconfig.json'. While running outside of the project by the VS Code extension, the <root> path is not correctly defined, so the project's config file is not resolvable and the path aliases are not loaded.
Solution
Just specify the absolute project config file path in your project's eslint config file.
Problem
When enable the import/order rule in eslint like following:
Format file with prettier-eslint plugin fails to correctly order the import statements, and gives this error below:
Where
@
is some path alias defined in the project'stsconfig.json
file.Reason
After debugging line by line of eslint, I finaly got that it is the
eslint-import-resolver-typescript
plugin which cannot parse the import path with an alias.The plugin is set default to resolve the project config file with path '/tsconfig.json'. While running outside of the project by the VS Code extension, the
<root>
path is not correctly defined, so the project's config file is not resolvable and the path aliases are not loaded.Solution
Just specify the absolute project config file path in your project's eslint config file.
The text was updated successfully, but these errors were encountered: