First of all, thanks for creating this plugin, it is really useful.
I'd like to report that if the tsconfig.json file does not contain the compilerOptions.baseUrl property, eslint --fix incorrectly updates affected files. For instance, for the following config:
{
"compilerOptions": {
"paths": {
"~/routers/*": ["./src/routers/*"],
}
}
}
And the following import in .src/tests/test/test.ts to import ./src/routers/userRouter.ts:
import { userRouter } from '../../routers/userRouter';
When you run eslint, it shows the error Update import to ~/uters/userRouter, that is, it cuts off the first 2 characters from the alias. Running eslint --fix then updates the file with the wrong and invalid import { userRouter } from '~/uters/userRouter'; import statement. The workaround is to set a baseUrl field so paths under paths can be absolute; however, it's not ideal because baseUrl has other side effects, such as potential module resolution conflicts with node_modules.
First of all, thanks for creating this plugin, it is really useful.
I'd like to report that if the
tsconfig.jsonfile does not contain thecompilerOptions.baseUrlproperty,eslint --fixincorrectly updates affected files. For instance, for the following config:{ "compilerOptions": { "paths": { "~/routers/*": ["./src/routers/*"], } } }And the following import in
.src/tests/test/test.tsto import./src/routers/userRouter.ts:When you run
eslint, it shows the error Update import to ~/uters/userRouter, that is, it cuts off the first 2 characters from the alias. Runningeslint --fixthen updates the file with the wrong and invalidimport { userRouter } from '~/uters/userRouter';import statement. The workaround is to set abaseUrlfield so paths underpathscan be absolute; however, it's not ideal becausebaseUrlhas other side effects, such as potential module resolution conflicts withnode_modules.