Skip to content

Auto-fix for import-style? #963

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

Open
fisker opened this issue Dec 25, 2020 · 2 comments
Open

Auto-fix for import-style? #963

fisker opened this issue Dec 25, 2020 · 2 comments

Comments

@fisker
Copy link
Collaborator

fisker commented Dec 25, 2020

import {dirname} from 'path';

const foo = dirname(bar)

->

import path from 'path';

const foo = path.dirname(bar)

I think it's doable.

@fisker fisker changed the title Auto-fix for unicorn/import-style? Auto-fix for import-style? Dec 25, 2020
@zanminkian
Copy link
Contributor

If there is a variable name the same as module, auto-fix is dangerous.

import {join} from 'path';

const path = join('/x', 'y');

@sindresorhus
Copy link
Owner

Auto-fix can easily detect conflicts and not auto-fix then or use a different name.

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

Successfully merging a pull request may close this issue.

3 participants