eslint-plugin-no-relative-import-paths
eslint-plugin-no-relative-import-paths copied to clipboard
Allow direct children rootDir imports
Hi, love this plugin!
I like the option rootDir
, would it be possible to add another option keep the rootDir
in the import if the import terminates with a direct children of the rootDir
.
I give an example to better understand.
Config
{ "rootDir": "src" }
src
folder structure
├── components
│ ├── ComponentA.tsx
├── hooks
│ ├── index.ts
├── utils.ts
└── index.ts
Original code
import utils from "src/utils";
import hooks from "src/hooks";
import ComponentA from "src/components/ComponentA"
Code after ESLint fixing with current implementation
import utils from "utils";
import hooks from "hooks";
import ComponentA from "components/ComponentA"
Code after ESLint fixing with proposed implementation
// src is kept
import utils from "src/utils";
// src is kept
import hooks from "src/hooks";
// src is removed
import ComponentA from "components/ComponentA"
Tell me what ou think about it please. I'd be happy to contribute to the change.
Thank you!