Skip to content

New eslint rule to prefer object shorthand - #2963

Merged
Crabcyborg merged 1 commit into
masterfrom
new_eslint_rule_to_prefer_object_shorthand
Feb 20, 2026
Merged

New eslint rule to prefer object shorthand#2963
Crabcyborg merged 1 commit into
masterfrom
new_eslint_rule_to_prefer_object_shorthand

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores

    • Updated ESLint configuration to enforce modern JavaScript object shorthand syntax.
  • Style

    • Refactored JavaScript codebase to use ES6 method shorthand and property shorthand syntax for improved code consistency and readability.

@coderabbitai

coderabbitai Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

ESLint configuration enables the object-shorthand rule enforcement, triggering a codebase-wide refactor to convert object method definitions and property assignments to ES6 shorthand syntax across 20+ JavaScript files without altering runtime behavior.

Changes

Cohort / File(s) Summary
ESLint Configuration
eslint.config.mjs
Enabled object-shorthand rule from 'off' to 'error' to enforce ES6 shorthand syntax across the project.
Admin Core JS
js/admin/deactivation-feedback.js, js/admin/dom.js, js/admin/embed.js, js/admin/legacy-views.js, js/admin/style.js
Converted object method definitions and AJAX callbacks from traditional function syntax (method: function() {}) to ES6 shorthand form (method() {}). Also replaced explicit property assignments with shorthand (property: propertyproperty).
Form Frontend JS
js/formidable.js, js/plugin-search.js
Updated public API method signatures and data object initializations to use ES6 shorthand syntax, reducing verbosity in form initialization and submission handlers.
Admin Global & Popup JS
js/formidable_admin_global.js
Refactored jQuery AJAX callbacks and init methods from function property form to concise method shorthand, maintaining functional equivalence.
Admin Module Suite
js/src/admin/addon-state.js, js/src/admin/admin.js, js/src/admin/styles.js, js/src/admin/upgrade-popup.js
Systematically converted method definitions and property assignments to shorthand syntax across authorization, license management, and UI initialization code.
API & Dashboard
js/src/api/class-addon-api.js, js/src/dashboard.js
Applied shorthand property syntax to AJAX payload objects and request bodies.
Form Block & Components
js/src/form/block.js, js/src/settings-components/components/slider-component.js, js/src/web-components/frm-range-slider-component/frm-range-slider-component.js
Updated Gutenberg block declarations and component configuration objects to use ES6 property and method shorthand.
Payment Integration Modules
stripe/js/connect_settings.js, stripe/js/frmstrp.js, stripe/js/frmtrans_admin.js, square/js/frontend.js
Refactored AJAX payloads, event details, and method declarations in Stripe and Square payment handlers to leverage ES6 shorthand syntax.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

The changes follow a single, repetitive pattern (object-shorthand syntax conversion) applied consistently across all files. While the volume spans 20+ files, the homogeneous nature of edits and absence of new logic or functional changes minimizes cognitive overhead per file. Each file requires verification that the refactor preserves method/property semantics without introducing unexpected this binding issues.

Poem

🐰 Hop along to ES6 style,
Methods shorthand, properties compile!
No functions verbose, just clean and sleek,
Modern syntax, code less antique!
thump thump

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly describes the main change: enabling an ESLint rule (object-shorthand) to enforce ES6 object/method shorthand syntax throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch new_eslint_rule_to_prefer_object_shorthand

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io

deepsource-io Bot commented Feb 20, 2026

Copy link
Copy Markdown

DeepSource Code Review

DeepSource reviewed changes in the commit range b89bf21...ad7a383 on this pull request. Below is the summary for the review, and you can see the individual issues we found as review comments.

For detailed review results, please see the PR on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. Please see the DeepSource dashboard for this PR to view those issues.

PR Report Card

Security × 0 issues Overall PR Quality   

Focus Area: Reliability

Guidance
Fix the 5 instances of 'jQuery' not being defined, particularly in stripe/js/frmtrans_admin.js.

Grade capped at C due to multiple critical issues
Reliability × 29 issues
Complexity × 2 issues
Hygiene × 6 issues

Code Review Summary

Analyzer Status Summary Details
PHP No new issues detected. Review ↗
JavaScript 37 new issues detected. 176 existing issues fixed. Review ↗
How are these analyzer statuses calculated?

Administrators can configure which issue categories are reported and cause analysis to be marked as failed when detected. This helps prevent bad and insecure code from being introduced in the codebase. If you're an administrator, you can modify this in the repository's settings.

Comment thread stripe/js/connect_settings.js
Comment thread stripe/js/frmtrans_admin.js
Comment thread stripe/js/frmtrans_admin.js
Comment thread stripe/js/frmtrans_admin.js
@Crabcyborg
Crabcyborg merged commit 44703cb into master Feb 20, 2026
41 of 45 checks passed
@Crabcyborg
Crabcyborg deleted the new_eslint_rule_to_prefer_object_shorthand branch February 20, 2026 15:27
stephywells pushed a commit that referenced this pull request Apr 4, 2026
…ject_shorthand

New eslint rule to prefer object shorthand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant