Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 24, 2025

Changelog

  • Updated eslint-plugin-primer-react from ^8.2.0 to ^8.4.0
  • Added primer-react/spread-props-first: warn (rather than error for incremental adoption)
  • Removed --max-warnings=0 from the npm run lint to allow warnings in CI again (added 4 years ago)

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, internal eslint change only

Testing & Reviewing

Merge checklist

  • NA Added/updated tests
  • NA Added/updated documentation
  • NA Added/updated previews (Storybook)
  • NA Changes are SSR compatible
  • NA Tested in Chrome
  • NA Tested in Firefox
  • NA Tested in Safari
  • NA Tested in Edge
  • NA (GitHub staff only) Integration tests pass at github/github (Learn more about how to run integration tests)

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

⚠️ No Changeset found

Latest commit: 2d9729f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@siddharthkp
Copy link
Member

@copilot Once you are done, also run npm run lint --fix

@github-actions github-actions bot temporarily deployed to storybook-preview-7071 October 24, 2025 17:09 Inactive
Copilot AI changed the title [WIP] Upgrade eslint-plugin-primer-react to v8.4.0 and enable spread-props-first Upgrade eslint-plugin-primer-react to v8.4.0 and enable spread-props-first rule Oct 24, 2025
Copilot finished work on behalf of siddharthkp October 24, 2025 17:27
Copilot AI requested a review from siddharthkp October 24, 2025 17:27
Copy link
Contributor Author

Copilot AI commented Oct 24, 2025

@copilot Once you are done, also run npm run lint --fix

Done! npm run lint --fix completed with no changes needed - the code is already properly linted.

Copilot finished work on behalf of siddharthkp October 24, 2025 17:33
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 24, 2025
@siddharthkp
Copy link
Member

siddharthkp commented Oct 24, 2025

@joshblack 159 files changed 😅

Do we rip the bandaid and update all of them? Alternate would be to make it a "suggestion" instead of "error" and over time whenever someone touches a file, they'd be encouraged to update that file?

Also, Wow didn't expect so many tests to fail as well!

@siddharthkp siddharthkp added the skip changeset This change does not need a changelog label Oct 24, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-7071 October 24, 2025 17:52 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-7071 October 24, 2025 18:00 Inactive
@joshblack
Copy link
Member

@siddharthkp I think we'll want this to be more incremental (whatever batch size makes sense) because we might see the issue come up where someone used to pass something that worked and now it won't if we have the same prop (e.g. className, on* props, whatever). What do you think?

@siddharthkp
Copy link
Member

we might see the issue come up where someone used to pass something that worked and now it won't if we have the same prop

Makes sense, definitely expecting that!

@siddharthkp
Copy link
Member

@copilot Move the rule to "suggestion" instead of "error". Remove all of the lint fixes that you had performed

Copy link
Contributor Author

Copilot AI commented Oct 27, 2025

@copilot Move the rule to "suggestion" instead of "error". Remove all of the lint fixes that you had performed

Done! Changed the rule to 'warn' and reverted all lint fixes in commit 0469266.

The rule now shows 321 warnings across the codebase that can be fixed incrementally. Note: npm run lint will currently fail due to --max-warnings=0 - you may want to adjust this temporarily during the migration period.

Copilot AI changed the title Upgrade eslint-plugin-primer-react to v8.4.0 and enable spread-props-first rule Upgrade eslint-plugin-primer-react to v8.4.0 and enable spread-props-first rule as warning Oct 27, 2025
@siddharthkp siddharthkp requested a review from a team as a code owner October 27, 2025 10:24
Copilot AI review requested due to automatic review settings October 27, 2025 10:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the eslint-plugin-primer-react package to v8.4.0 and enables the new spread-props-first ESLint rule as a warning to prevent unintentional prop overrides when spread operators are used after named props.

Key changes:

  • Package version bump from ^8.2.0 to ^8.4.0
  • New ESLint rule enabled as 'warn' to allow incremental adoption
  • Removed --max-warnings=0 flag from lint script to allow CI to pass with warnings

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
package.json Updated eslint-plugin-primer-react version and modified lint script to allow warnings
eslint.config.mjs Added spread-props-first rule configuration as warning level

@siddharthkp siddharthkp added integration-tests: skipped manually Changes in this PR do not require an integration test and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 27, 2025
@siddharthkp
Copy link
Member

Removed integration-tests: recommended because now there are no changes to any src files

@siddharthkp siddharthkp removed the integration-tests: skipped manually Changes in this PR do not require an integration test label Oct 27, 2025
@github-actions github-actions bot requested a deployment to storybook-preview-7071 October 27, 2025 10:32 Abandoned
@github-actions github-actions bot requested a deployment to storybook-preview-7071 October 27, 2025 10:45 Abandoned
@github-actions github-actions bot temporarily deployed to storybook-preview-7071 October 27, 2025 10:57 Inactive
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 27, 2025
@github-actions
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot requested a deployment to storybook-preview-7071 October 27, 2025 11:15 Abandoned
"build:components.json": "npm run build:components.json -w @primer/react",
"build:hooks.json": "npm run build:hooks.json -w @primer/react",
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0 --cache",
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --cache",
Copy link
Member

@siddharthkp siddharthkp Oct 27, 2025

Choose a reason for hiding this comment

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

Note for reviewer:

We could add a number here which matches the current number of warnings for this one rule, but then we also have to keep it updated any time we fix a warning so that other warnings don't sneak into the gap

Suggested change
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --cache",
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=321 --cache",

"build:docs:preview": "NODE_OPTIONS=--openssl-legacy-provider script/build-docs preview",
"build:components.json": "npm run build:components.json -w @primer/react",
"build:hooks.json": "npm run build:hooks.json -w @primer/react",
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0 --cache",
Copy link
Member

Choose a reason for hiding this comment

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

Note for reviewer: This is the only bad part about making the rule "warn" instead of "error". We open up warnings from other rules as well because there is no way to allow warnings from one rule.

Copy link
Member

@siddharthkp siddharthkp left a comment

Choose a reason for hiding this comment

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

Added my comments for other reviewers

@joshblack
Copy link
Member

@siddharthkp just wanted to share an idea for the migration if it would be of interest (also sorry about the delay!)

We could have the rule off by default but only enable it for a certain number of files (or exclude files where we know it's a problem) and could use the migration-status workflow to report on the migration: https://github.com/primer/react/blob/main/.github/workflows/migration-status.yml

So we could:

  1. Enable it by default (so that new files have the rule enabled)
  2. Add an override in the eslint config that turns it off for the files that we want to change over time (this can be what is used in the migraiton script)
  3. Instruct copilot to work in batches based off of that override, gradually moving over until there are no more overrides

This could help to prevent the warn vs error kind of stuff too if it's helpful

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

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants