Skip to content

Conversation

@andreww2012
Copy link
Contributor

@andreww2012 andreww2012 commented Jul 17, 2025

The plugin rule currently allows extra properties to be passed in the second options object, which should not be allowed because they're not used by the rule, and this only makes it easier for typos in rule options to go unnoticed.

This PR simply disallows extra properties in this rule's schema.


Important

Disallows extra properties in the second options object of the prettier rule schema in eslint-plugin-prettier.js.

  • Behavior:
    • Disallows extra properties in the second options object of the prettier rule schema in eslint-plugin-prettier.js.
    • Ensures only specified properties (usePrettierrc, fileInfoOptions) are allowed, preventing unnoticed typos.

This description was created by Ellipsis for 7aa6758. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Refactor
    • Enhanced configuration validation for the prettier rule by restricting allowed options to only explicitly defined properties, preventing the use of any additional unexpected settings.

@changeset-bot
Copy link

changeset-bot bot commented Jul 17, 2025

🦋 Changeset detected

Latest commit: 2f1eb39

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-prettier Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Jul 17, 2025

Walkthrough

The update refines the JSON schema validation for the prettier rule options in the ESLint plugin configuration. The schema now disallows any properties other than usePrettierrc and fileInfoOptions in the second options object, enforcing stricter validation without affecting runtime logic or control flow.

Changes

Cohort / File(s) Change Summary
ESLint Plugin Schema Update
eslint-plugin-prettier.js
Tightened JSON schema for the prettier rule: set additionalProperties to false in the second options object, restricting allowed properties to usePrettierrc and fileInfoOptions.
Changeset Documentation
.changeset/twelve-jokes-act.md
Added a changeset file documenting the patch update enforcing stricter validation disallowing additional unexpected properties in rule options.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

In the warren of lint, we hop with care,
Schema now stricter—no extras to spare!
Only the named may burrow inside,
The rest must wait, or hop aside.
With tidy rules, our code will gleam—
Prettier than a bunny’s dream! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 7aa6758 and 2f1eb39.

📒 Files selected for processing (2)
  • .changeset/twelve-jokes-act.md (1 hunks)
  • eslint-plugin-prettier.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/twelve-jokes-act.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • eslint-plugin-prettier.js
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 7aa6758 in 1 minute and 0 seconds. Click for details.
  • Reviewed 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. eslint-plugin-prettier.js:169
  • Draft comment:
    Setting 'additionalProperties' to false here enforces strict validation for the second options object, preventing unnoticed typos. Ensure that allowing extra properties in the nested 'fileInfoOptions' (line 164-167) is intentional.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_GnEnsGcPuBrDPpsq

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jul 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-prettier@751

commit: 2f1eb39

@JounQin JounQin force-pushed the fix/disallow-extra-properties-in-rule-options branch from 7aa6758 to 300cbc7 Compare August 6, 2025 08:41
@JounQin JounQin merged commit cf52b30 into prettier:main Aug 6, 2025
12 checks passed
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Aug 7, 2025
| datasource | package                | from  | to    |
| ---------- | ---------------------- | ----- | ----- |
| npm        | eslint-plugin-prettier | 5.4.0 | 5.5.4 |


## [v5.5.4](https://github.com/prettier/eslint-plugin-prettier/blob/HEAD/CHANGELOG.md#554)

##### Patch Changes

- [#755](prettier/eslint-plugin-prettier#755) [`723f7a8`](prettier/eslint-plugin-prettier@723f7a8) Thanks [@kbrilla](https://github.com/kbrilla)! - fix: add 'oxc', 'oxc-ts' and 'hermes' parsers to `parserBlocklist`

- [#751](prettier/eslint-plugin-prettier#751) [`cf52b30`](prettier/eslint-plugin-prettier@cf52b30) Thanks [@andreww2012](https://github.com/andreww2012)! - fix: disallow extra properties in rule options


## [v5.5.3](https://github.com/prettier/eslint-plugin-prettier/releases/tag/v5.5.3)

republish the latest version

**Full Changelog**: prettier/eslint-plugin-prettier@v5.5.2...v5.5.3


## [v5.5.2](https://github.com/prettier/eslint-plugin-prettier/releases/tag/v5.5.2)

### Changelog

#### 5.5.1

##### Patch Changes

- [#748](prettier/eslint-plugin-prettier#748) [`bfd1e95`](prettier/eslint-plugin-prettier@bfd1e95) Thanks [@JounQin](https://github.com/JounQin)! - fix: use `prettierRcOptions` directly for prettier 3.6+

#### 5.5.0

##### Minor Changes

- [#743](prettier/eslint-plugin-prettier#743) [`92f2c9c`](prettier/eslint-plugin-prettier@92f2c9c) Thanks [@dotcarmen](https://github.com/dotcarmen)! - feat: support non-js languages like `css` for `@eslint/css` and `json` for `@eslint/json`

#### 5.4.1

##### Patch Changes

- [#740](prettier/eslint-plugin-prettier#740) [`c21521f`](prettier/eslint-plugin-prettier@c21521f) Thanks [@JounQin](https://github.com/JounQin)! - fix(deps): bump `synckit` to v0.11.7 to fix potential `TypeError: Cannot read properties of undefined (reading 'message')` error

#### 5.4.0

##### Minor Changes

- [#736](prettier/eslint-plugin-prettier#736) [`59a0cae`](prettier/eslint-plugin-prettier@59a0cae) Thanks [@yashtech00](https://github.com/yashtech00)! - refactor: migrate `worker.js` to `worker.mjs`

#### 5.3.1

##### Patch Changes

- [#734](prettier/eslint-plugin-prettier#734) [`dcf2c80`](prettier/eslint-plugin-prettier@dcf2c80) Thanks [@JounQin](https://github.com/JounQin)! - ci: enable `NPM_CONFIG_PROVENANCE` env

#### 5.3.0

##### Minor Changes

- [#674](prettier/eslint-plugin-prettier#674) [`6fe0c90`](prettier/eslint-plugin-prettier@6fe0c90) Thanks [@irsooti](https://github.com/irsooti)! - feat(types): prefer `Config` over `FlatConfig` when they're equal

#### 5.2.6

##### Patch Changes

- [#723](prettier/eslint-plugin-prettier#723) [`1451176`](prettier/eslint-plugin-prettier@1451176) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): bump `synckit` to `v0.11.0`

#### 5.2.5

##### Patch Changes

- [#721](prettier/eslint-plugin-prettier#721) [`4f5513d`](