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

[no-duplicates] prefer-inline should merge type and non-type imports #2675

Open
latin-1 opened this issue Jan 14, 2023 · 8 comments
Open

[no-duplicates] prefer-inline should merge type and non-type imports #2675

latin-1 opened this issue Jan 14, 2023 · 8 comments

Comments

@latin-1
Copy link

latin-1 commented Jan 14, 2023

Input:

import { A } from "./mod";
import type { B } from "./mod";

Output:

import { A, type B } from "./mod";
@latin-1
Copy link
Author

latin-1 commented Jan 14, 2023

There is also a regression in 2.27:

Input:

import { A } from "./mod";
import { type B } from "./mod";

Output:

// 2.26
import { A, type B } from "./mod";
// 2.27
import { A } from "./mod";
import { type B } from "./mod";

I opened another issue for this regression: #2677

@latin-1
Copy link
Author

latin-1 commented Jan 16, 2023

cc @snewcomer

@snewcomer
Copy link
Contributor

snewcomer commented Jan 16, 2023

@latin-1 I'm also seeing this. Thank you. At one time, I applied all these changes to the ember.js repo and to a large API and everything worked swimmingly. However, I think it was when everything was bundled up in this PR before we split it up. I don't clearly remember. I do plan on looking at this this week.

@simmo
Copy link
Contributor

simmo commented Jan 17, 2023

I might be mistaken, but I think the docs might be wrong. As I understand it, it is supposed to be ["error", "prefer-inline"] to align with import/consistent-type-specifier-style, but the only allowed syntax is ["error", {"prefer-inline": true}]. I'm easy either way just thought I'd flag it 😄

@ljharb
Copy link
Member

ljharb commented Jan 17, 2023

@simmo that doesn't seem right - the schema is clear that it's a string, not an object. Are you sure you're using the latest version of the plugin?

@simmo
Copy link
Contributor

simmo commented Jan 17, 2023

Yep I'm using 2.27.5. It allows object syntax but not string.
image

@ljharb
Copy link
Member

ljharb commented Jan 17, 2023

ohhh yes, that's correct, they have a different schema (i was checking consistent-type-specifier-style).

I don't think it's worth adding a string overload for no-duplicates, nor an object overload for consistent-type-specifier-style, but I agree it ends up being an inconsistency. If the docs are wrong, a PR to fix them would be appreciated!

@simmo
Copy link
Contributor

simmo commented Jan 18, 2023

If the docs are wrong, a PR to fix them would be appreciated!

My pleasure 😄 - PR for documentation #2684

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

No branches or pull requests

4 participants