Repository navigation
fix: don't report __proto__ properties in object-shorthand - #21310
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe ChangesObject shorthand
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The rule excludes non-computed proto prototype setters from shorthand enforcement and autofixing, with no outstanding merge-readiness risk identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
DMartens
left a comment
There was a problem hiding this comment.
Thank you for the PR.
I am able to reproduce this behavior and agree that __proto__ should be exempted.
DMartens
left a comment
There was a problem hiding this comment.
Changes LGTM, thanks. Leaving open for others to review.
| datasource | package | from | to | | ---------- | ------- | ------ | ------- | | npm | eslint | 10.9.1 | 10.11.0 | ## [v10.11.0](https://github.com/eslint/eslint/releases/tag/v10.11.0) #### Features - [`d136fa4`](eslint/eslint@d136fa4) feat: object-shorthand handle quoted properties for `ignoreConstructors` ([#21271](eslint/eslint#21271)) (Pavel) - [`397b3b8`](eslint/eslint@397b3b8) feat: report unsafe labeled `continue` in `no-unsafe-finally` rule ([#21316](eslint/eslint#21316)) (electrohyun) - [`d3dd47f`](eslint/eslint@d3dd47f) feat: only exempt `new-cap` built-ins that reference the global ([#21290](eslint/eslint#21290)) (sethamus) #### Bug Fixes - [`22b09f5`](eslint/eslint@22b09f5) fix: ignore `__proto__` properties in `prefer-object-spread` ([#21311](eslint/eslint#21311)) (xbinaryx) - [`b684bb1`](eslint/eslint@b684bb1) fix: make TimePass.parse optional in types and docs ([#21313](eslint/eslint#21313)) (ntnyq) - [`26d11bc`](eslint/eslint@26d11bc) fix: don't report `__proto__` properties in `object-shorthand` ([#21310](eslint/eslint#21310)) (xbinaryx) #### Documentation - [`9ecfdc5`](eslint/eslint@9ecfdc5) docs: note that --cache can serve stale results for cross-file rules ([#21312](eslint/eslint#21312)) (bytedoe) - [`6c789ff`](eslint/eslint@6c789ff) docs: Update README (GitHub Actions Bot) - [`5997825`](eslint/eslint@5997825) docs: clarify preserve-caught-error known limitation ([#21294](eslint/eslint#21294)) (Akinyemi Toluwalase) #### Chores - [`520dd77`](eslint/eslint@520dd77) perf: Implement fast paths in critical areas ([#21210](eslint/eslint#21210)) (Nicholas C. Zakas) - [`92086c8`](eslint/eslint@92086c8) test: update `EMFILE` error generation for Node.js 26.9.0 compatibility ([#21330](eslint/eslint#21330)) (Francesco Trotta) - [`9ac7eb6`](eslint/eslint@9ac7eb6) chore: update github/codeql-action action to v4.38.0 ([#21331](eslint/eslint#21331)) (renovate\[bot]) - [`24310e3`](eslint/eslint@24310e3) chore: update ecosystem plugins ([#21324](eslint/eslint#21324)) (ESLint Bot) - [`45ad79e`](eslint/eslint@45ad79e) ci: bump pnpm/action-setup from 6.0.10 to 6.1.0 ([#21318](eslint/eslint#21318)) (dependabot\[bot]) - [`ac74e37`](eslint/eslint@ac74e37) chore: Add AGENTS.md with AI disclosure requirements ([#21221](eslint/eslint#21221)) (Nicholas C. Zakas) - [`c832660`](eslint/eslint@c832660) chore: Upgrade Stylelint to the latest version in docs ([#21245](eslint/eslint#21245)) (Jung Hyeon Jun) - [`f9f88fc`](eslint/eslint@f9f88fc) chore: update ecosystem plugins ([#21308](eslint/eslint#21308)) (ESLint Bot) - [`fc81076`](eslint/eslint@fc81076) ci: add more types integration tests ([#20395](eslint/eslint#20395)) (Nitin Kumar) ## [v10.10.0](https://github.com/eslint/eslint/releases/tag/v10.10.0) #### Features - [`264b434`](eslint/eslint@264b434) feat: add `d` and `v` flags to `no-unexpected-multiline` ([#21305](eslint/eslint#21305)) (Gihyeon Jeong / 정기현) - [`c6cc6c5`](eslint/eslint@c6cc6c5) feat: check `Object.prototype` property names in `new-cap` ([#21269](eslint/eslint#21269)) (crimsonjay0) - [`5661fa6`](eslint/eslint@5661fa6) feat: no-extra-bind false negatives with class fields and static blocks ([#21260](eslint/eslint#21260)) (synthex-byte) #### Bug Fixes - [`bb47dc6`](eslint/eslint@bb47dc6) fix: update dependency file-entry-cache to v11 ([#20801](eslint/eslint#20801)) (Milos Djermanovic) - [`427ac0a`](eslint/eslint@427ac0a) fix: use format strings in debug calls ([#21247](eslint/eslint#21247)) (Francesco Trotta) - [`9d81532`](eslint/eslint@9d81532) fix: support `__proto__` in `/* exported */` comments ([#21261](eslint/eslint#21261)) (sethamus) - [`87e0a08`](eslint/eslint@87e0a08) fix: prefer-object-has-own autofix breaks when Object is shadowed ([#21282](eslint/eslint#21282)) (김채영) - [`8e2cb14`](eslint/eslint@8e2cb14) fix: `new-cap` false positive for `UTC` calls with `properties: false` ([#21275](eslint/eslint#21275)) (Pixel) - [`9f4a364`](eslint/eslint@9f4a364) fix: Ignore static imports in no-unreachable ([#21276](eslint/eslint#21276)) (Taha Kotil) #### Documentation - [`2417cad`](eslint/eslint@2417cad) docs: Update README (GitHub Actions Bot) - [`9cecb8a`](eslint/eslint@9cecb8a) docs: document `\c` control letter escapes in no-control-regex ([#21286](eslint/eslint#21286)) (한국) - [`8724829`](eslint/eslint@8724829) docs: update compat table links ([#21263](eslint/eslint#21263)) (fnx) - [`5634542`](eslint/eslint@5634542) docs: Clarify eqeqeq suggestion behavior ([#21256](eslint/eslint#21256)) (Müslüm Yılmaz) #### Chores - [`b3d876b`](eslint/eslint@b3d876b) chore: disable npm audit in ecosystem tests ([#21306](eslint/eslint#21306)) (Francesco Trotta) - [`1696682`](eslint/eslint@1696682) ci: restore EMFILE test on Node.js 26 ([#21297](eslint/eslint#21297)) (Marry (Subin Yang)) - [`2c7f5d6`](eslint/eslint@2c7f5d6) chore: update github/codeql-action action to v4.37.9 ([#21296](eslint/eslint#21296)) (renovate\[bot]) - [`3c753f1`](eslint/eslint@3c753f1) chore: update eslint ([#21289](eslint/eslint#21289)) (renovate\[bot]) - [`1c73469`](eslint/eslint@1c73469) chore: update ecosystem plugins ([#21280](eslint/eslint#21280)) (ESLint Bot) - [`08a02be`](eslint/eslint@08a02be) test: add error locations to `no-extra-boolean-cast` ([#21266](eslint/eslint#21266)) (lumir) - [`77bb1db`](eslint/eslint@77bb1db) chore: update github/codeql-action action to v4.37.8 ([#21270](eslint/eslint#21270)) (renovate\[bot]) - [`007e81a`](eslint/eslint@007e81a) ci: skip EMFILE test on Node.js 26 ([#21265](eslint/eslint#21265)) (lumir) - [`0430280`](eslint/eslint@0430280) chore: improve ecosystem tests compatibility on Windows ([#21178](eslint/eslint#21178)) (crimsonjay0)
| datasource | package | from | to | | ---------- | ------- | ------ | ------- | | npm | eslint | 10.9.1 | 10.11.0 | ## [v10.11.0](https://github.com/eslint/eslint/releases/tag/v10.11.0) #### Features - [`d136fa4`](eslint/eslint@d136fa4) feat: object-shorthand handle quoted properties for `ignoreConstructors` ([#21271](eslint/eslint#21271)) (Pavel) - [`397b3b8`](eslint/eslint@397b3b8) feat: report unsafe labeled `continue` in `no-unsafe-finally` rule ([#21316](eslint/eslint#21316)) (electrohyun) - [`d3dd47f`](eslint/eslint@d3dd47f) feat: only exempt `new-cap` built-ins that reference the global ([#21290](eslint/eslint#21290)) (sethamus) #### Bug Fixes - [`22b09f5`](eslint/eslint@22b09f5) fix: ignore `__proto__` properties in `prefer-object-spread` ([#21311](eslint/eslint#21311)) (xbinaryx) - [`b684bb1`](eslint/eslint@b684bb1) fix: make TimePass.parse optional in types and docs ([#21313](eslint/eslint#21313)) (ntnyq) - [`26d11bc`](eslint/eslint@26d11bc) fix: don't report `__proto__` properties in `object-shorthand` ([#21310](eslint/eslint#21310)) (xbinaryx) #### Documentation - [`9ecfdc5`](eslint/eslint@9ecfdc5) docs: note that --cache can serve stale results for cross-file rules ([#21312](eslint/eslint#21312)) (bytedoe) - [`6c789ff`](eslint/eslint@6c789ff) docs: Update README (GitHub Actions Bot) - [`5997825`](eslint/eslint@5997825) docs: clarify preserve-caught-error known limitation ([#21294](eslint/eslint#21294)) (Akinyemi Toluwalase) #### Chores - [`520dd77`](eslint/eslint@520dd77) perf: Implement fast paths in critical areas ([#21210](eslint/eslint#21210)) (Nicholas C. Zakas) - [`92086c8`](eslint/eslint@92086c8) test: update `EMFILE` error generation for Node.js 26.9.0 compatibility ([#21330](eslint/eslint#21330)) (Francesco Trotta) - [`9ac7eb6`](eslint/eslint@9ac7eb6) chore: update github/codeql-action action to v4.38.0 ([#21331](eslint/eslint#21331)) (renovate\[bot]) - [`24310e3`](eslint/eslint@24310e3) chore: update ecosystem plugins ([#21324](eslint/eslint#21324)) (ESLint Bot) - [`45ad79e`](eslint/eslint@45ad79e) ci: bump pnpm/action-setup from 6.0.10 to 6.1.0 ([#21318](eslint/eslint#21318)) (dependabot\[bot]) - [`ac74e37`](eslint/eslint@ac74e37) chore: Add AGENTS.md with AI disclosure requirements ([#21221](eslint/eslint#21221)) (Nicholas C. Zakas) - [`c832660`](eslint/eslint@c832660) chore: Upgrade Stylelint to the latest version in docs ([#21245](eslint/eslint#21245)) (Jung Hyeon Jun) - [`f9f88fc`](eslint/eslint@f9f88fc) chore: update ecosystem plugins ([#21308](eslint/eslint#21308)) (ESLint Bot) - [`fc81076`](eslint/eslint@fc81076) ci: add more types integration tests ([#20395](eslint/eslint#20395)) (Nitin Kumar) ## [v10.10.0](https://github.com/eslint/eslint/releases/tag/v10.10.0) #### Features - [`264b434`](eslint/eslint@264b434) feat: add `d` and `v` flags to `no-unexpected-multiline` ([#21305](eslint/eslint#21305)) (Gihyeon Jeong / 정기현) - [`c6cc6c5`](eslint/eslint@c6cc6c5) feat: check `Object.prototype` property names in `new-cap` ([#21269](eslint/eslint#21269)) (crimsonjay0) - [`5661fa6`](eslint/eslint@5661fa6) feat: no-extra-bind false negatives with class fields and static blocks ([#21260](eslint/eslint#21260)) (synthex-byte) #### Bug Fixes - [`bb47dc6`](eslint/eslint@bb47dc6) fix: update dependency file-entry-cache to v11 ([#20801](eslint/eslint#20801)) (Milos Djermanovic) - [`427ac0a`](eslint/eslint@427ac0a) fix: use format strings in debug calls ([#21247](eslint/eslint#21247)) (Francesco Trotta) - [`9d81532`](eslint/eslint@9d81532) fix: support `__proto__` in `/* exported */` comments ([#21261](eslint/eslint#21261)) (sethamus) - [`87e0a08`](eslint/eslint@87e0a08) fix: prefer-object-has-own autofix breaks when Object is shadowed ([#21282](eslint/eslint#21282)) (김채영) - [`8e2cb14`](eslint/eslint@8e2cb14) fix: `new-cap` false positive for `UTC` calls with `properties: false` ([#21275](eslint/eslint#21275)) (Pixel) - [`9f4a364`](eslint/eslint@9f4a364) fix: Ignore static imports in no-unreachable ([#21276](eslint/eslint#21276)) (Taha Kotil) #### Documentation - [`2417cad`](eslint/eslint@2417cad) docs: Update README (GitHub Actions Bot) - [`9cecb8a`](eslint/eslint@9cecb8a) docs: document `\c` control letter escapes in no-control-regex ([#21286](eslint/eslint#21286)) (한국) - [`8724829`](eslint/eslint@8724829) docs: update compat table links ([#21263](eslint/eslint#21263)) (fnx) - [`5634542`](eslint/eslint@5634542) docs: Clarify eqeqeq suggestion behavior ([#21256](eslint/eslint#21256)) (Müslüm Yılmaz) #### Chores - [`b3d876b`](eslint/eslint@b3d876b) chore: disable npm audit in ecosystem tests ([#21306](eslint/eslint#21306)) (Francesco Trotta) - [`1696682`](eslint/eslint@1696682) ci: restore EMFILE test on Node.js 26 ([#21297](eslint/eslint#21297)) (Marry (Subin Yang)) - [`2c7f5d6`](eslint/eslint@2c7f5d6) chore: update github/codeql-action action to v4.37.9 ([#21296](eslint/eslint#21296)) (renovate\[bot]) - [`3c753f1`](eslint/eslint@3c753f1) chore: update eslint ([#21289](eslint/eslint#21289)) (renovate\[bot]) - [`1c73469`](eslint/eslint@1c73469) chore: update ecosystem plugins ([#21280](eslint/eslint#21280)) (ESLint Bot) - [`08a02be`](eslint/eslint@08a02be) test: add error locations to `no-extra-boolean-cast` ([#21266](eslint/eslint#21266)) (lumir) - [`77bb1db`](eslint/eslint@77bb1db) chore: update github/codeql-action action to v4.37.8 ([#21270](eslint/eslint#21270)) (renovate\[bot]) - [`007e81a`](eslint/eslint@007e81a) ci: skip EMFILE test on Node.js 26 ([#21265](eslint/eslint#21265)) (lumir) - [`0430280`](eslint/eslint@0430280) chore: improve ecosystem tests compatibility on Windows ([#21178](eslint/eslint#21178)) (crimsonjay0)
| datasource | package | from | to | | ---------- | ------- | ------ | ------- | | npm | eslint | 10.9.1 | 10.11.0 | ## [v10.11.0](https://github.com/eslint/eslint/releases/tag/v10.11.0) #### Features - [`d136fa4`](eslint/eslint@d136fa4) feat: object-shorthand handle quoted properties for `ignoreConstructors` ([#21271](eslint/eslint#21271)) (Pavel) - [`397b3b8`](eslint/eslint@397b3b8) feat: report unsafe labeled `continue` in `no-unsafe-finally` rule ([#21316](eslint/eslint#21316)) (electrohyun) - [`d3dd47f`](eslint/eslint@d3dd47f) feat: only exempt `new-cap` built-ins that reference the global ([#21290](eslint/eslint#21290)) (sethamus) #### Bug Fixes - [`22b09f5`](eslint/eslint@22b09f5) fix: ignore `__proto__` properties in `prefer-object-spread` ([#21311](eslint/eslint#21311)) (xbinaryx) - [`b684bb1`](eslint/eslint@b684bb1) fix: make TimePass.parse optional in types and docs ([#21313](eslint/eslint#21313)) (ntnyq) - [`26d11bc`](eslint/eslint@26d11bc) fix: don't report `__proto__` properties in `object-shorthand` ([#21310](eslint/eslint#21310)) (xbinaryx) #### Documentation - [`9ecfdc5`](eslint/eslint@9ecfdc5) docs: note that --cache can serve stale results for cross-file rules ([#21312](eslint/eslint#21312)) (bytedoe) - [`6c789ff`](eslint/eslint@6c789ff) docs: Update README (GitHub Actions Bot) - [`5997825`](eslint/eslint@5997825) docs: clarify preserve-caught-error known limitation ([#21294](eslint/eslint#21294)) (Akinyemi Toluwalase) #### Chores - [`520dd77`](eslint/eslint@520dd77) perf: Implement fast paths in critical areas ([#21210](eslint/eslint#21210)) (Nicholas C. Zakas) - [`92086c8`](eslint/eslint@92086c8) test: update `EMFILE` error generation for Node.js 26.9.0 compatibility ([#21330](eslint/eslint#21330)) (Francesco Trotta) - [`9ac7eb6`](eslint/eslint@9ac7eb6) chore: update github/codeql-action action to v4.38.0 ([#21331](eslint/eslint#21331)) (renovate\[bot]) - [`24310e3`](eslint/eslint@24310e3) chore: update ecosystem plugins ([#21324](eslint/eslint#21324)) (ESLint Bot) - [`45ad79e`](eslint/eslint@45ad79e) ci: bump pnpm/action-setup from 6.0.10 to 6.1.0 ([#21318](eslint/eslint#21318)) (dependabot\[bot]) - [`ac74e37`](eslint/eslint@ac74e37) chore: Add AGENTS.md with AI disclosure requirements ([#21221](eslint/eslint#21221)) (Nicholas C. Zakas) - [`c832660`](eslint/eslint@c832660) chore: Upgrade Stylelint to the latest version in docs ([#21245](eslint/eslint#21245)) (Jung Hyeon Jun) - [`f9f88fc`](eslint/eslint@f9f88fc) chore: update ecosystem plugins ([#21308](eslint/eslint#21308)) (ESLint Bot) - [`fc81076`](eslint/eslint@fc81076) ci: add more types integration tests ([#20395](eslint/eslint#20395)) (Nitin Kumar) ## [v10.10.0](https://github.com/eslint/eslint/releases/tag/v10.10.0) #### Features - [`264b434`](eslint/eslint@264b434) feat: add `d` and `v` flags to `no-unexpected-multiline` ([#21305](eslint/eslint#21305)) (Gihyeon Jeong / 정기현) - [`c6cc6c5`](eslint/eslint@c6cc6c5) feat: check `Object.prototype` property names in `new-cap` ([#21269](eslint/eslint#21269)) (crimsonjay0) - [`5661fa6`](eslint/eslint@5661fa6) feat: no-extra-bind false negatives with class fields and static blocks ([#21260](eslint/eslint#21260)) (synthex-byte) #### Bug Fixes - [`bb47dc6`](eslint/eslint@bb47dc6) fix: update dependency file-entry-cache to v11 ([#20801](eslint/eslint#20801)) (Milos Djermanovic) - [`427ac0a`](eslint/eslint@427ac0a) fix: use format strings in debug calls ([#21247](eslint/eslint#21247)) (Francesco Trotta) - [`9d81532`](eslint/eslint@9d81532) fix: support `__proto__` in `/* exported */` comments ([#21261](eslint/eslint#21261)) (sethamus) - [`87e0a08`](eslint/eslint@87e0a08) fix: prefer-object-has-own autofix breaks when Object is shadowed ([#21282](eslint/eslint#21282)) (김채영) - [`8e2cb14`](eslint/eslint@8e2cb14) fix: `new-cap` false positive for `UTC` calls with `properties: false` ([#21275](eslint/eslint#21275)) (Pixel) - [`9f4a364`](eslint/eslint@9f4a364) fix: Ignore static imports in no-unreachable ([#21276](eslint/eslint#21276)) (Taha Kotil) #### Documentation - [`2417cad`](eslint/eslint@2417cad) docs: Update README (GitHub Actions Bot) - [`9cecb8a`](eslint/eslint@9cecb8a) docs: document `\c` control letter escapes in no-control-regex ([#21286](eslint/eslint#21286)) (한국) - [`8724829`](eslint/eslint@8724829) docs: update compat table links ([#21263](eslint/eslint#21263)) (fnx) - [`5634542`](eslint/eslint@5634542) docs: Clarify eqeqeq suggestion behavior ([#21256](eslint/eslint#21256)) (Müslüm Yılmaz) #### Chores - [`b3d876b`](eslint/eslint@b3d876b) chore: disable npm audit in ecosystem tests ([#21306](eslint/eslint#21306)) (Francesco Trotta) - [`1696682`](eslint/eslint@1696682) ci: restore EMFILE test on Node.js 26 ([#21297](eslint/eslint#21297)) (Marry (Subin Yang)) - [`2c7f5d6`](eslint/eslint@2c7f5d6) chore: update github/codeql-action action to v4.37.9 ([#21296](eslint/eslint#21296)) (renovate\[bot]) - [`3c753f1`](eslint/eslint@3c753f1) chore: update eslint ([#21289](eslint/eslint#21289)) (renovate\[bot]) - [`1c73469`](eslint/eslint@1c73469) chore: update ecosystem plugins ([#21280](eslint/eslint#21280)) (ESLint Bot) - [`08a02be`](eslint/eslint@08a02be) test: add error locations to `no-extra-boolean-cast` ([#21266](eslint/eslint#21266)) (lumir) - [`77bb1db`](eslint/eslint@77bb1db) chore: update github/codeql-action action to v4.37.8 ([#21270](eslint/eslint#21270)) (renovate\[bot]) - [`007e81a`](eslint/eslint@007e81a) ci: skip EMFILE test on Node.js 26 ([#21265](eslint/eslint#21265)) (lumir) - [`0430280`](eslint/eslint@0430280) chore: improve ecosystem tests compatibility on Windows ([#21178](eslint/eslint#21178)) (crimsonjay0)
Prerequisites checklist
AI acknowledgment
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What parser are you using (place an "X" next to just one item)?
[x]
Default (Espree)[ ]
@typescript-eslint/parser[ ]
@babel/eslint-parser[ ]
vue-eslint-parser[ ]
@angular-eslint/template-parser[ ]
OtherPlease show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
No errors. A non-computed
__proto__key in an object literal is a prototype setter, not an ordinary property, so there is no shorthand form that preserves its meaning.What actually happened? Please include the actual, raw output from ESLint.
Both are reported and autofixed into code that behaves differently.
What changes did you make? (Give an overview)
Property:exitreturns early for such properties.isRedundant()returns false for them.Is there anything you'd like reviewers to focus on?
Summary by CodeRabbit
Bug Fixes
__proto__properties.Tests
__proto__properties and methods across supported configurations, including valid cases, reported errors, and autofixes.