Skip to content

docs: add eslint to install command - #258

Merged
DMartens merged 3 commits into
eslint:mainfrom
minseonkkim:main
Jul 16, 2026
Merged

DMartens merged 3 commits into
eslint:mainfrom
minseonkkim:main

Conversation

@minseonkkim

@minseonkkim minseonkkim commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

Documentation update.

@eslint/json does not declare eslint as a peer dependency, so installing the plugin alone does not install ESLint. However, the install commands in the README only include @eslint/json, which may lead new users to miss the required eslint dependency. This PR updates the install commands to include eslint so users can get started without missing dependencies.

What changes did you make? (Give an overview)

Added eslint to the install commands in the README for npm, yarn, pnpm, and bun:

  • npm install @eslint/json -D → npm install eslint @eslint/json -D
  • yarn add @eslint/json -D → yarn add eslint @eslint/json -D
  • pnpm install @eslint/json -D → pnpm install eslint @eslint/json -D
  • bun add @eslint/json -D → bun add eslint @eslint/json -D

Related Issues

Is there anything you'd like reviewers to focus on?

No.

@eslint-github-bot eslint-github-bot Bot added the documentation Improvements or additions to documentation label Jul 13, 2026
@eslintbot eslintbot added this to Triage Jul 13, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Triage Jul 13, 2026
@DMartens DMartens moved this from Needs Triage to Feedback Needed in Triage Jul 13, 2026
@DMartens

Copy link
Copy Markdown

Thank you for filing a PR for this.
I think the proper fix would be to declare the peer dependency on eslint rather than updating the documentation as we recommend this for plugins in the docs.
I could not find issues regarding this but all three official language plugins (css, markdown and json) do not declare the peer dependency.
I would like to know how other team members feel about this @eslint/eslint-team.

@fasttime

Copy link
Copy Markdown
Member

I think the proper fix would be to declare the peer dependency on eslint rather than updating the documentation as we recommend this for plugins in the docs. I could not find issues regarding this but all three official language plugins (css, markdown and json) do not declare the peer dependency. I would like to know how other team members feel about this @eslint/eslint-team.

@eslint/js already includes ESLint v10 as an optional peer dependency (https://github.com/eslint/eslint/blob/main/packages/js/package.json#L33-L40):

"peerDependencies": {
  "eslint": "^10.0.0"
},
"peerDependenciesMeta": {
  "eslint": {
    "optional": true
  }
}

We could add the same settings for this plugin (and also @eslint/css and @eslint/markdown) and set an appropriate ESLint version range, for example "eslint": "^9.15.0 || ^10.0.0".

That would be a breaking change, though, because it could break npm install for a package that depends on this plugin and also depends on an older version of eslint. A non-breaking alternative would be to set "eslint": "*".

@lumirlumir

lumirlumir commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

The rationale for removing eslint from peerDependencies -- and for not retaining it as an optional peer dependency through peerDependenciesMeta -- comes from #25, eslint/markdown#284, and eslint/css#273 (comment)

The initial commit did include peerDependenciesMeta with eslint marked as optional, but it was removed following the discussion. As explained in the thread, the primary concern was compatibility with Code Explorer (and perhaps broader JavaScript runtime compatibility)


Given the original rationale, I believe we can simply add instructions to install eslint at the beginning of the @eslint/json installation section. @eslint/js follows the same approach, recommending that users install eslint before installing @eslint/js. I believe @eslint/json should do the same.


As for why @eslint/js still declares eslint as an optional peer dependency: I believe Code Explorer uses @eslint/json, @eslint/css, and @eslint/markdown in the browser, whereas @eslint/js is used only in the Node.js environment through eslint.config.js.

I think this distinction explains why @eslint/js retains peerDependenciesMeta with eslint marked as optional instead of removing the peer dependency entirely.


So, to clarify, I’m +1 on this change. It would also bring the @eslint/json installation instructions more closely in line with those for @eslint/js.

Comment thread README.md Resolved
Updated installation instructions for ESLint to include options for various package managers.
lumirlumir
lumirlumir previously approved these changes Jul 15, 2026

@lumirlumir lumirlumir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!


It looks good to me, but I’d like to know what @DMartens and @fasttime think about the comment in #258 (comment) before merging.

I believe that’s the original thread for the discussion around peerDependencies, but I just wanted to double-check.

@lumirlumir lumirlumir moved this from Feedback Needed to Second Review Needed in Triage Jul 15, 2026
Comment thread README.md Resolved
@fasttime

Copy link
Copy Markdown
Member

As for why @eslint/js still declares eslint as an optional peer dependency: I believe Code Explorer uses @eslint/json, @eslint/css, and @eslint/markdown in the browser, whereas @eslint/js is used only in the Node.js environment through eslint.config.js.

I think this distinction explains why @eslint/js retains peerDependenciesMeta with eslint marked as optional instead of removing the peer dependency entirely.

The optional peer dependency in @eslint/js is intended to signal compatibility with specific ESLint versions. It is currently "^10.0.0", but if a new core rule is added in ESLint v10.X.0, the range would be bumped to "^10.X.0" to reflect the minimum version in which that rule exists.

I think the optional peer dependency solves a different problem and it wouldn’t help in the use case described in the OP, since npm doesn't automatically install optional peer dependencies. A mandatory peer dependency would, but that would come with other drawbacks.

@fasttime fasttime left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@DMartens

Copy link
Copy Markdown

Thank you for the context lumir.
I am going to open a PR for updating the eslint/css documentation (eslint/markdown was recently updated to specify that ESLint is required).
Changes LGTM, thanks.

@DMartens
DMartens merged commit 4916d28 into eslint:main Jul 16, 2026
33 checks passed
@github-project-automation github-project-automation Bot moved this from Second Review Needed to Complete in Triage Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted documentation Improvements or additions to documentation

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

4 participants