feat(types): prefer Config over FlatConfig when they're equal by irsooti · Pull Request #674 · prettier/eslint-plugin-prettier (original) (raw)

Walkthrough

A new changeset file was added to document a minor update to the eslint-plugin-prettier package. The update introduces a conditional type alias, IfEqual, within the type declarations. This alias is used to determine if Linter.Config and Linter.FlatConfig are equivalent, and accordingly sets the type of recommendedConfig to prefer Config when both types are equal. No changes were made to the declarations of exported or public entities beyond the type alias and the updated type for recommendedConfig.

Changes

File(s) Change Summary
.changeset/lucky-badgers-judge.md Added a changeset documenting a minor update to the eslint-plugin-prettier package regarding type preference.
recommended.d.ts Introduced IfEqual type alias; updated recommendedConfig type to use conditional type logic for type equality.

Sequence Diagram(s)

sequenceDiagram participant Developer participant TypeSystem

Developer->>TypeSystem: Reference recommendedConfig
TypeSystem->>TypeSystem: Evaluate IfEqual<Linter.Config, Linter.FlatConfig, Linter.Config, Linter.FlatConfig>
alt Types are equal
    TypeSystem-->>Developer: recommendedConfig is Linter.Config
else Types are not equal
    TypeSystem-->>Developer: recommendedConfig is Linter.FlatConfig
end

Loading

Poem

A hop and a skip, a type check anew,
Where Configs and FlatConfigs meet in review.
If equal, we cheer, and Config takes the lead,
If not, FlatConfig fulfills every need.
With changesets noted and types all aligned,
This rabbit approves—what a clever design!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e37575 and 42abb5d.

📒 Files selected for processing (2)

recommended.d.ts (1)

10-10: The type condition appropriately handles ESLint version compatibility.

This change implements the preference for Config over FlatConfig when they're equal, aligning with ESLint's deprecation notice while maintaining backward compatibility with both ESLint v8 and v9.

.changeset/lucky-badgers-judge.md (1)

1-5: Appropriate changeset documentation for a minor version change.

The changeset correctly documents this as a minor version change with a clear description that matches the implementation. This ensures users are properly informed about the change in the release notes.

✨ Finishing Touches


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Chat

There are 3 ways to chat with CodeRabbit:

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

Other keywords and placeholders

CodeRabbit Configuration File (.coderabbit.yaml)

Documentation and Community