-
Notifications
You must be signed in to change notification settings - Fork 45
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
Bug: sort-intersection-types conflicts with Prettier on object literal and parenthesized union #407
Comments
Hi @JoshuaKGoldberg 👋 Could you write the |
D'oh, sorry! I got so used to quickly reporting issues I forgot to respect the checklist. 🙈 Full repro here: https://github.com/JoshuaKGoldberg/repros/tree/repro-perfectionist-sort-intersection-types-conflict-prettier import js from "@eslint/js";
import perfectionist from "eslint-plugin-perfectionist";
import tseslint from "typescript-eslint";
export default tseslint.config(
js.configs.recommended,
tseslint.configs.recommended,
perfectionist.configs["recommended-natural"],
); Prettier is set with defaults. |
@JoshuaKGoldberg Thank you! The issue comes from how we compute names to compare: in type ExtensionlessExportOrImport = {
moduleSpecifier: ts.StringLiteral;
} & (
| ts.ExportDeclaration
| ts.ImportDeclaration
); one node will have type ExtensionlessExportOrImport = {
moduleSpecifier: ts.StringLiteral;
} & (ts.ExportDeclaration | ts.ImportDeclaration); it will have
Technically speaking, The quick-fix you can do on your end is setting the Users should ideally not have to do that to have a working configuration, though, so we can try to provide a fix as well, but I'm not sure if we can do that without potentially breaking the current sort order of users. |
Hi, we set |
Describe the bug
npx eslint . --fix
on the following code autofixes to a layout that Prettier then autofixes right back.Code example
Original code, as formatted by Prettier, with a lint report on the
{\n ... \n}
:Code after
perfectionist/sort-intersection-types
autofixes it:Code after formatting with Prettier:
ESLint version
9.16.0
ESLint Plugin Perfectionist version
4.1.2
Additional comments
Not sure if the bug is here or in Prettier... 🤔
Validations
The text was updated successfully, but these errors were encountered: