Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow direct children rootDir imports #16

Open
GabriFila opened this issue Oct 13, 2022 · 0 comments
Open

Allow direct children rootDir imports #16

GabriFila opened this issue Oct 13, 2022 · 0 comments

Comments

@GabriFila
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant