-
Notifications
You must be signed in to change notification settings - Fork 645
Upgrade eslint-plugin-primer-react to v8.4.0 and enable spread-props-first rule: warn #7071
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
base: main
Are you sure you want to change the base?
Conversation
|
|
@copilot Once you are done, also run |
Co-authored-by: siddharthkp <[email protected]>
…first rule Co-authored-by: siddharthkp <[email protected]>
Done! |
|
👋 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! |
|
@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 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? |
Makes sense, definitely expecting that! |
|
@copilot Move the rule to "suggestion" instead of "error". Remove all of the lint fixes that you had performed |
Co-authored-by: siddharthkp <[email protected]>
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: |
There was a problem hiding this 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=0flag 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 |
|
Removed |
|
👋 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! |
…m lint command" This reverts commit d754263.
| "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", |
There was a problem hiding this comment.
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
| "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", |
There was a problem hiding this comment.
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.
siddharthkp
left a comment
There was a problem hiding this 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
|
@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:
This could help to prevent the warn vs error kind of stuff too if it's helpful |
Changelog
eslint-plugin-primer-reactfrom^8.2.0to^8.4.0--max-warnings=0from thenpm run lintto allow warnings in CI again (added 4 years ago)Rollout strategy
Testing & Reviewing
Merge checklist