Use eslint 9#2961
Conversation
DeepSource reviewed changes in the commit range For detailed review results, please see the PR on DeepSource ↗ PR Report CardCode Review Summary
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. |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThis PR migrates ESLint from legacy Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 10
🧹 Nitpick comments (6)
js/src/web-components/frm-web-component.js (2)
156-156: Trailing whitespace left after removing the inline disable comment.Removing the
// eslint-disable-linecomment from this line left trailing spaces after{}. Ifno-trailing-spacesis enforced in the new config this will be a lint error.🧹 Proposed fix
- disconnectedCallback() {} + disconnectedCallback() {}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@js/src/web-components/frm-web-component.js` at line 156, The line containing the empty lifecycle method disconnectedCallback() has trailing whitespace after the closing braces; open the definition for disconnectedCallback in frm-web-component.js (the disconnectedCallback() function) and remove the trailing spaces so the line ends immediately after the braces (i.e., ensure "disconnectedCallback() {}" has no trailing whitespace) to satisfy the no-trailing-spaces rule.
156-156: Trailing whitespace left after removing the inline disable comment.The line
disconnectedCallback() {}has trailing spaces — an artifact of in-line comment removal. Ifno-trailing-spacesis active in the new config this will be a lint error.🧹 Proposed fix
- disconnectedCallback() {} + disconnectedCallback() {}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@js/src/web-components/frm-web-component.js` at line 156, Remove the trailing whitespace at the end of the empty disconnectedCallback() {} declaration in the frm-web-component class: edit the line containing disconnectedCallback() {} to have no trailing spaces (ensure the closing brace is the last character on the line) so it no longer triggers the no-trailing-spaces lint rule; re-run the linter to confirm the warning is gone.eslint.config.mjs (4)
63-77: Redundant global declarations.
windowanddocument(lines 70–71) are already included inglobals.browser(line 64). Similarly,cy,Cypress,expect,assert, andchaiare already included inglobals.mocha(line 67) and/or would be covered by the Cypress plugin globals. These redundant entries are harmless but add clutter.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eslint.config.mjs` around lines 63 - 77, The globals object in eslint.config.mjs redundantly re-declares names already provided by shared presets/plugins; remove the explicit entries for window and document (they come from globals.browser) and remove cy, Cypress, expect, assert, chai (covered by globals.mocha and Cypress plugin globals) while keeping project-specific entries like wp and wpApiSettings; update the globals block that spreads globals.browser and globals.mocha to eliminate the duplicate literal declarations so lint config is cleaner.
149-153: Several core lint rules are broadly disabled — consider revisiting.
no-unused-vars,no-undef,no-shadow,no-console,eqeqeq, andno-alertare all turned off globally. While this is pragmatic for a large migration, these are valuable safety nets (especiallyno-undefandno-unused-vars). Consider tracking these as tech debt to re-enable incrementally.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eslint.config.mjs` around lines 149 - 153, The PR globally disables important ESLint rules ('no-unused-vars', 'no-undef', 'no-shadow', 'no-console', 'eqeqeq', 'no-alert') which reduces safety; instead, revert these from 'off' to safer settings incrementally: for broad codebase stability set them to 'warn' in eslint.config.mjs and add targeted overrides or directory-specific rule exceptions for legacy files, and create a tracked tech-debt TODO (e.g., in the repo issue tracker) to progressively re-enable as fixes are made; update the eslint config entries for the specific rules named above and add comments/overrides for any files that must remain disabled temporarily.
113-114: Consider usingflat/recommendedinstead offlat/allfor unicorn.Spreading
unicornPlugin.configs['flat/all'].rules(line 114) enables every unicorn rule, then lines 241–289 immediately turn off ~50 of them. Usingflat/recommendedinstead would reduce noise and make the intent clearer — you'd only need to list the additional rules you want to enable rather than disabling the ones you don't.Also applies to: 241-289
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eslint.config.mjs` around lines 113 - 114, Replace the spread of unicornPlugin.configs['flat/all'].rules with unicornPlugin.configs['flat/recommended'].rules in the ESLint config and remove or prune the subsequent block that explicitly turns off ~50 unicorn rules (the overrides that follow the current spread); instead, only list the specific additional unicorn rules you want to enable/disable. Concretely, update the spread expression from unicornPlugin.configs['flat/all'].rules to unicornPlugin.configs['flat/recommended'].rules and then delete or simplify the later rule-disablements so the config relies on the recommended set plus only the explicit custom rule tweaks you need.
291-321: Large block of TODO rules turned off — track as tech debt.Lines 291–321 contain ~30 rules marked with "TODO: New rules to look into" that are all set to
'off'. This is fine for the migration, but consider creating a tracking issue so these don't remain indefinitely unreviewed.Would you like me to open an issue to track reviewing and enabling these rules incrementally?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eslint.config.mjs` around lines 291 - 321, Create a tracking issue to treat the large block of disabled ESLint rules as tech debt: list the specific rule names from the diff (e.g., 'jsdoc/check-tag-names', 'no-jquery/no-sizzle', 'sonarjs/anchor-precedence', 'sonarjs/no-nested-conditional', 'sonarjs/unused-import', 'unicorn/prefer-global-this', etc.), assign an owner, add a priority and label (tech-debt/lint), and include an incremental plan to evaluate each rule (impact analysis, tests, autofix where possible) and a timeline for enabling them one-by-one or in small groups so they don't remain off indefinitely.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@eslint.config.mjs`:
- Line 165: The eslint config contains duplicate rule keys:
'jsdoc/check-tag-names' and 'no-jquery/no-sizzle' are declared twice with
conflicting severities; remove or consolidate the duplicates so each rule
appears only once with the intended severity—either delete the earlier
declarations where they are overridden or remove the later ones that override
the originals; update the single authoritative entry for 'jsdoc/check-tag-names'
and 'no-jquery/no-sizzle' to the correct severity and ensure no duplicate keys
remain.
In `@js/formidable_admin_global.js`:
- Line 3: Remove the trailing whitespace on line 3 of
js/formidable_admin_global.js and restore ESLint rule overrides for this file:
either re-add the file-level comment /* eslint-disable prefer-const,
compat/compat */ at the top of js/formidable_admin_global.js or add an entry in
eslint.config.mjs that disables prefer-const and compat/compat for this filename
(or its glob) so the many let declarations (e.g., lines referenced 6, 48, 126,
137, 172, 174, 196, 224, 255, 270) do not trigger lint errors.
In `@js/formidable.js`:
- Line 2: Remove the trailing whitespace from the blank line in js/formidable.js
that was left after removing the ESLint disable comment (same pattern as the
other blank lines where the comment was removed); locate the blank line which
previously held the ESLint disable comment and delete the trailing space so the
line is truly empty.
- Line 1721: There are leftover trailing whitespace characters after removing
inline eslint-disable comments; locate the blank lines that previously held
those inline "eslint-disable" comments (search for the nearby "eslint-disable"
occurrences or the empty lines immediately after where those comments were
removed) and delete the trailing tab/space characters so the lines are truly
empty (remove the trailing whitespace on both occurrences).
In `@js/src/form-templates/elements/applicationTemplatesElement.js`:
- Around line 63-66: Remove the trailing space on the line that declares
thumbnailURL and either refactor the nested ternary into a clear conditional or
add an ESLint exception for the no-nested-ternary rule; specifically, edit the
thumbnailURL assignment (references: thumbnailURL, hasLiteThumbnail, isWebp,
thumbnailBaseURL, key) to eliminate the trailing whitespace and replace the
nested ternary with an if/else or ternary flattened into separate computed
values, or update the ESLint config to disable/configure no-nested-ternary for
this line so linting passes.
In
`@js/src/web-components/frm-range-slider-component/frm-range-slider-component.js`:
- Line 467: The inline "// eslint-disable-line no-new" must not be removed from
the instantiation of frmSliderComponent (new frmSliderComponent(
this.wrapper.querySelectorAll( '.frm-slider-component' ), options );) unless you
explicitly disable the no-new rule in the ESLint config; either retain the
inline disable comment on that line, or add "'no-new': 'off'" to the rules
section of eslint.config.mjs so the linter won’t flag the use of new without
assignment; pick one approach and apply it consistently for frmSliderComponent
instantiations.
In `@package.json`:
- Line 54: The dependency `@wordpress/eslint-plugin`@22.5.0 in package.json does
not support ESLint 9 flat config; update package.json to either upgrade
`@wordpress/eslint-plugin` to a version that adds flat config support (if
available) or replace it with a compatibility adapter such as
`@cassidydc/eslint-plugin-wordpress`, or remove the plugin and implement an
equivalent ruleset directly in the flat config; ensure the package.json
dependency entry for "@wordpress/eslint-plugin" is updated (or substituted) and
run npm/yarn install and lint to verify the flat config works with eslint v9.
In `@stripe/js/frmstrp.js`:
- Around line 552-555: There is an extraneous line containing only trailing
whitespace immediately above the return that builds the hex color (the line
before the return starting with `return \`#${ (( 1 << 24 ) + ...`). Remove that
blank/whitespace-only line so there are no trailing spaces before the return
expression in the function that computes the hex color (the return that uses
bitwise shifts `1 << 24`, `parseInt( rgba[0], 10 ) << 16`, etc.).
In `@tests/cypress/e2e/Forms/formPageDataValidation.cy.js`:
- Around line 176-181: The test uses Chai property assertions
(expect(html.split('<br>')[1]).to.exist.and.not.be.empty) which ESLint's
no-unused-expressions flags after migrating to the flat config; update
eslint.config.mjs to either add and enable eslint-plugin-chai-friendly
(replacing no-unused-expressions with chai-friendly) or add an override for test
files (e.g., matching Cypress tests) to disable/adjust no-unused-expressions or
enable the cypress plugin's recommended rules so Chai assertions in files like
tests/cypress/e2e/Forms/formPageDataValidation.cy.js do not trigger lint errors.
- Around line 176-181: The Cypress test uses a Chai property-based assertion
(expect(...).to.exist.and.not.be.empty) which triggers ESLint's
no-unused-expressions; fix by updating the ESLint flat config to handle Chai
assertions for test files: install and enable eslint-plugin-chai-friendly (or
chai-friendly) and either replace the rule with
"chai-friendly/no-unused-expressions" or add an override for "*.cy.js" files
that disables "no-unused-expressions" and enables
"chai-friendly/no-unused-expressions"; ensure the override targets .cy.js tests
so the cy.get(...).invoke('html').then(...) assertion no longer lints as an
unused expression.
---
Nitpick comments:
In `@eslint.config.mjs`:
- Around line 63-77: The globals object in eslint.config.mjs redundantly
re-declares names already provided by shared presets/plugins; remove the
explicit entries for window and document (they come from globals.browser) and
remove cy, Cypress, expect, assert, chai (covered by globals.mocha and Cypress
plugin globals) while keeping project-specific entries like wp and
wpApiSettings; update the globals block that spreads globals.browser and
globals.mocha to eliminate the duplicate literal declarations so lint config is
cleaner.
- Around line 149-153: The PR globally disables important ESLint rules
('no-unused-vars', 'no-undef', 'no-shadow', 'no-console', 'eqeqeq', 'no-alert')
which reduces safety; instead, revert these from 'off' to safer settings
incrementally: for broad codebase stability set them to 'warn' in
eslint.config.mjs and add targeted overrides or directory-specific rule
exceptions for legacy files, and create a tracked tech-debt TODO (e.g., in the
repo issue tracker) to progressively re-enable as fixes are made; update the
eslint config entries for the specific rules named above and add
comments/overrides for any files that must remain disabled temporarily.
- Around line 113-114: Replace the spread of
unicornPlugin.configs['flat/all'].rules with
unicornPlugin.configs['flat/recommended'].rules in the ESLint config and remove
or prune the subsequent block that explicitly turns off ~50 unicorn rules (the
overrides that follow the current spread); instead, only list the specific
additional unicorn rules you want to enable/disable. Concretely, update the
spread expression from unicornPlugin.configs['flat/all'].rules to
unicornPlugin.configs['flat/recommended'].rules and then delete or simplify the
later rule-disablements so the config relies on the recommended set plus only
the explicit custom rule tweaks you need.
- Around line 291-321: Create a tracking issue to treat the large block of
disabled ESLint rules as tech debt: list the specific rule names from the diff
(e.g., 'jsdoc/check-tag-names', 'no-jquery/no-sizzle',
'sonarjs/anchor-precedence', 'sonarjs/no-nested-conditional',
'sonarjs/unused-import', 'unicorn/prefer-global-this', etc.), assign an owner,
add a priority and label (tech-debt/lint), and include an incremental plan to
evaluate each rule (impact analysis, tests, autofix where possible) and a
timeline for enabling them one-by-one or in small groups so they don't remain
off indefinitely.
In `@js/src/web-components/frm-web-component.js`:
- Line 156: The line containing the empty lifecycle method
disconnectedCallback() has trailing whitespace after the closing braces; open
the definition for disconnectedCallback in frm-web-component.js (the
disconnectedCallback() function) and remove the trailing spaces so the line ends
immediately after the braces (i.e., ensure "disconnectedCallback() {}" has no
trailing whitespace) to satisfy the no-trailing-spaces rule.
- Line 156: Remove the trailing whitespace at the end of the empty
disconnectedCallback() {} declaration in the frm-web-component class: edit the
line containing disconnectedCallback() {} to have no trailing spaces (ensure the
closing brace is the last character on the line) so it no longer triggers the
no-trailing-spaces lint rule; re-run the linter to confirm the warning is gone.
There was a problem hiding this comment.
Actionable comments posted: 11
🧹 Nitpick comments (8)
js/src/web-components/frm-web-component.js (1)
36-38: Optional: Align remaining@returntags to match the@returnsupdate.The PR converts
@return→@returnson Line 92, but three other JSDoc blocks in this file still use the old@returntag (and single-star/* */comment style). A quick follow-up pass would make them consistent.♻️ Proposed alignment
- /* - * Load the component style. - * `@return` string - */ + /** + * Load the component style. + * `@returns` {string} + */ loadStyle() {- /* - * Render the component inside the shadow root. - * `@return` void - */ + /** + * Render the component inside the shadow root. + * `@returns` {void} + */ render() {- /* - * Called by browser when the component is removed from the DOM. - * `@return` void - */ + /** + * Called by browser when the component is removed from the DOM. + * `@returns` {void} + */ disconnectedCallback() {}Also applies to: 51-53, 142-144
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@js/src/web-components/frm-web-component.js` around lines 36 - 38, Update the three JSDoc blocks that still use the single-star comment style and the old `@return` tag to the standard JSDoc format: change the opening comment to /** ... */ and replace `@return` with `@returns` so they match the existing update; specifically fix the block whose description is "Load the component style." and the two other JSDoc blocks noted in the file (the remaining `@return` occurrences) so all JSDoc comments use /** and `@returns` consistently..github/workflows/jscs.yml (1)
37-37:--legacy-peer-depsshould be treated as a temporary workaround.This flag silently bypasses npm v7+'s strict peer dependency enforcement, which can allow version-incompatible packages to be installed without warning. It's a common pragmatic choice during ESLint 9 migrations, but it's worth tracking whether the underlying peer dependency conflicts can eventually be resolved with explicit
overridesentries inpackage.jsononce the ecosystem catches up, so the flag can be removed.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/jscs.yml at line 37, The CI job currently runs "npm ci --include=dev --legacy-peer-deps" which uses --legacy-peer-deps as a temporary bypass; locate the run step in the jscs workflow and remove the --legacy-peer-deps flag, replace it with a short TODO comment and create a tracking issue to resolve underlying peer conflicts; then add explicit package.json "overrides" entries for the conflicting packages (or update dependency versions) so the workflow can run without --legacy-peer-deps, and once verified remove the TODO and flag entirely..github/workflows/stylelint.yml (2)
22-22: Consider pinning to a specific Node.js 22 version for reproducibility.The previous value
20.10.0was a pinned patch release;"22"will float across all22.x.yreleases and could silently introduce behavior changes between runs. While a floating major version is common in CI, it reduces exact reproducibility.♻️ Proposed change
- node-version: "22" + node-version: "22.x"Or pin to a specific patch (e.g.
"22.14.0") if strict reproducibility is required.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/stylelint.yml at line 22, The workflow currently sets node-version: "22" which floats across patch releases; change the node-version value in the .github/workflows/stylelint.yml (the node-version key in that job definition) to a pinned patch release like "22.14.0" (or whichever specific 22.x.y you want) to ensure reproducible CI runs.
37-37:--legacy-peer-depsis a workaround — track its removal.This flag suppresses npm v7+ strict peer-dependency validation, masking unresolved peer conflicts introduced by the ESLint 9 migration. While acceptable as a short-term bridge, it should be removed once the peer-dependency tree in
package.jsonis reconciled (i.e., all packages declare compatible peer ranges for ESLint 9).Consider opening a follow-up issue to audit and fix the conflicting peer dependencies so this flag can be dropped.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/stylelint.yml at line 37, Remove the temporary --legacy-peer-deps flag from the workflow step that runs "npm ci --include=dev --legacy-peer-deps" and instead run "npm ci --include=dev" once peer deps are reconciled; open a follow-up issue (e.g., "Audit peer dependencies for ESLint 9 and remove --legacy-peer-deps from stylelint workflow") to track fixing incompatible peer ranges in package.json, and add a short TODO comment next to the npm ci run step referencing that issue so the removal is tracked.js/src/core/factory/createPageElements.js (1)
31-31:@returns {void}description conflates return value with side-effect documentation.The description "Updates the elements object by merging the new elements into it." describes the function's side effect, not its return value. A
@returns {void}tag conventionally carries no description (or simply "Nothing"), as there is no meaningful return value. The side-effect detail is better placed in the main prose body of the JSDoc block.✏️ Proposed fix
- * `@returns` {void} Updates the elements object by merging the new elements into it. + * `@returns` {void}And move the side-effect note into the block description:
/** * Add new elements to the elements object. + * + * Merges `newElements` into the existing elements object. * * `@param` {Object} newElements An object containing new elements to be added. * `@throws` {Error} Throws an error if the `newElements` is not a non-null object. * `@returns` {void} */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@js/src/core/factory/createPageElements.js` at line 31, Update the JSDoc for the createPageElements function: remove the side-effect description from the `@returns` {void} tag (leave it as just void or "Nothing") and move the text "Updates the elements object by merging the new elements into it." into the main JSDoc description/body above the tags so the return tag only documents the absence of a return value; locate and edit the JSDoc block for createPageElements in createPageElements.js.eslint.config.mjs (2)
70-71:windowanddocumentare redundant — both are already provided byglobals.browser.
globals.browser(spread at line 64) already includeswindowanddocumentas'readonly'globals, so lines 70-71 duplicate those entries.♻️ Proposed fix
- window: 'readonly', - document: 'readonly',🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eslint.config.mjs` around lines 70 - 71, Remove the redundant explicit globals "window" and "document" from the ESLint config since you already spread globals.browser into the globals object (see the existing globals.browser spread); delete the separate "window" and "document" entries so they aren't duplicated and rely on globals.browser's 'readonly' definitions instead.
114-114: UseunicornPlugin.configs.allinstead of the deprecatedunicornPlugin.configs['flat/all'].The backwards-compatibility alias
configs['flat/all']is deprecated ineslint-plugin-unicornand marked for removal in a future major release. The canonical flat config key isconfigs.all, which is the usage shown in the official README and TypeScript types.♻️ Proposed fix
- ...unicornPlugin.configs['flat/all'].rules, + ...unicornPlugin.configs.all.rules,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@eslint.config.mjs` at line 114, Replace the deprecated unicornPlugin.configs['flat/all'] usage with the canonical unicornPlugin.configs.all in the ESLint flat config; locate where unicornPlugin.configs['flat/all'] is referenced (the array of extended configs) and update it to unicornPlugin.configs.all, keeping the same import/name (unicornPlugin) so the replacement is a direct swap with no other changes.package.json (1)
80-81: Consider using a caret range foreslintandeslint-import-resolver-node.Both
eslint: 9.39.2andeslint-import-resolver-node: 0.3.9are exact-pinned without^, inconsistent with every other package in this block. ESLint's latest release is now 10.0.0, meaning 9.x is entering maintenance mode and will only receive critical bug/security fixes going forward. An exact pin on 9.39.2 prevents automatically picking up any such patches.Using
^9.39.2and^0.3.9respectively would allow safe patch-level updates while still locking to the intended major version.♻️ Suggested change
- "eslint": "9.39.2", - "eslint-import-resolver-node": "0.3.9", + "eslint": "^9.39.2", + "eslint-import-resolver-node": "^0.3.9",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` around lines 80 - 81, Update the package.json devDependencies entries for eslint and eslint-import-resolver-node from exact pins to caret ranges so they match the other packages; change "eslint": "9.39.2" to "eslint": "^9.39.2" and "eslint-import-resolver-node": "0.3.9" to "eslint-import-resolver-node": "^0.3.9" and run your lockfile install to persist the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.stylelintrc.json:
- Line 32: Remove the deprecated scss rule
"scss/at-import-no-partial-leading-underscore" from the .stylelintrc.json
configuration (it is redundant because the replacement
"scss/load-no-partial-leading-underscore" is already present); simply delete the
"scss/at-import-no-partial-leading-underscore" entry so only
"scss/load-no-partial-leading-underscore" remains.
In `@eslint.config.mjs`:
- Line 112: The current code only reads
compatPlugin.configs['flat/recommended'][0]?.rules which drops rules from later
config objects in the flat preset; update the logic where
compatPlugin.configs['flat/recommended'] is consumed (the place referencing
[0]?.rules) to either (A) merge rules from all config objects in the array by
iterating the array and Object.assign/merge each .rules into a single rules
object, or (B) simpler: spread the entire
compatPlugin.configs['flat/recommended'] array into the outer flat config
alongside the WordPress preset and remove the inline [.rules] spread so you
don’t lose later config objects—adjust the code that currently accesses
[0]?.rules (refer to compatPlugin.configs['flat/recommended']) accordingly.
- Line 45: Replace the direct access to the non-existent flat preset from the
WordPress plugin by instantiating ESLint's FlatCompat and using it to convert
the eslintrc-style preset: import { FlatCompat } from "@eslint/eslintrc" and
call new FlatCompat({ baseDirectory: __dirname
}).compat(wordpressPlugin.configs["recommended-with-formatting"]) instead of
reading configs["flat/recommended-with-formatting"]; also update React and
Unicorn usages to their flat-style configs by switching
reactPlugin.configs.recommended.rules to reactPlugin.configs.flat.recommended
and unicornPlugin.configs['flat/all'] to unicornPlugin.configs.all; finally
remove explicit window and document globals since globals.browser already covers
them (remove window/document from the globals export).
- Line 102: The config currently spreads only
reactPlugin.configs.flat.recommended.rules which omits languageOptions,
settings, and plugins from the flat config; replace that spread with the full
flat config by adding reactPlugin.configs.flat.recommended as a top-level entry
in the exported array alongside the WordPress preset (instead of nesting only
.rules), ensuring the file's export uses the complete
reactPlugin.configs.flat.recommended object so languageOptions, settings and
plugins are preserved.
In `@js/admin/dom.js`:
- Line 458: The JSDoc return type `{string|null}` is inconsistent with the
implementation which uses Array.prototype.find (returns `undefined` if not
found) and the description that says "or undefined"; update the JSDoc for the
cookie-getting function (e.g., getCookie / the function that parses
document.cookie and uses .find) to `@returns {string|undefined}` to match actual
behavior, or alternatively change the description to say "or null" if you change
the implementation to return `null`; ensure the doc matches the symbol that does
the find and that no code paths actually return `null`.
In `@js/formidable.js`:
- Line 1729: There is a residual trailing whitespace on the blank line left
after removing an ESLint comment; open js/formidable.js around the blank area
that follows the ESLint-comment removal (the same region as the previously-fixed
trailing-whitespace instances) and delete any spaces or tabs on that empty line
so it is truly empty, then save/run the formatter or ESLint autofix to ensure no
trailing whitespace remains.
- Line 918: The guard in scrollMsg currently checks frm_js.offset with a strict
string comparison (=== '-1') which mismatches the numeric check at line 918 and
allows the sentinel -1 to be ignored; change the check inside scrollMsg to use a
loose numeric comparison (e.g., compare against -1 using != or ==) so it matches
the numeric offset produced by wp_localize_script and prevents applying the
offset when frm_js.offset is -1; locate the check in function scrollMsg and
update the comparison to use frm_js.offset != -1 (or equivalent loose numeric
comparison) so scrollToFirstField and scrollMsg behave consistently.
In `@js/src/admin/admin.js`:
- Line 239: The file introduced the camelCase alias frmAdminJs but left four
direct references to the old global frm_admin_js; update the four usages (the
properties holdShiftMsg, no_label, noTitleText, import_complete) to use
frmAdminJs instead of frm_admin_js so all accesses are consistent. Locate
occurrences of frm_admin_js.holdShiftMsg, frm_admin_js.no_label,
frm_admin_js.noTitleText, and frm_admin_js.import_complete and replace them with
frmAdminJs.holdShiftMsg, frmAdminJs.no_label, frmAdminJs.noTitleText, and
frmAdminJs.import_complete respectively, ensuring you do not change property
names or surrounding logic.
In `@js/src/core/ui/counter.js`:
- Line 10: Update the JSDoc for the counter function to reflect that it may
return null: change the `@returns` annotation from {HTMLElement} to
{HTMLElement|null} so it matches the runtime behavior in the counter function
(which returns null when the element is not found or is not a valid
HTMLElement). Ensure the comment sits above the counter function declaration and
maintain existing description text.
In
`@js/src/web-components/frm-tab-navigator-component/frm-tab-navigator-component.js`:
- Line 14: Update the JSDoc return annotations to include the null case for
functions that can return null: change the `@returns` for initView to
{Element|null} (since initView explicitly returns null when this.tabs.length ===
0) and change the `@returns` for getTabUnderline to {Element|null} (it calls
shadowRoot.querySelector which may return null); locate the JSDoc blocks above
initView and getTabUnderline in frm-tab-navigator-component.js and append
"|null" to their return types so the docs/types accurately reflect possible null
returns.
- Line 55: Update the JSDoc return types for the five methods that return DOM
elements: change the incorrect `@returns` {string} to an appropriate DOM type
(e.g., `@returns` {HTMLElement} or a more specific type like {HTMLDivElement} /
{HTMLSpanElement}) for getTabDelimiter, getTabs, getTabContainer,
createTabHeading, and createTabContainer to reflect that they return values
created by document.createElement(...) rather than strings; ensure each method's
`@returns` matches the actual element created (e.g., if createTabHeading uses
document.createElement('div') use {HTMLDivElement}).
---
Duplicate comments:
In `@package.json`:
- Line 64: Confirm and fix how `@wordpress/eslint-plugin`@24.1.0 is consumed in
eslint.config.mjs: open eslint.config.mjs and check whether it imports the
plugin directly as a flat-config export (e.g., import wp from
"@wordpress/eslint-plugin") or uses the legacy .eslintrc style; if the plugin
does not export a flat config, wrap legacy rules/plugins via FlatCompat from
"@eslint/eslintrc" (create FlatCompat({ flatConfig: true }) and call
compat.extend or compat.add) to load the plugin, or alternatively import the
plugin's explicit flat export if one exists; update the import/usage in
eslint.config.mjs accordingly and remove any direct legacy-style plugin
references that assume .eslintrc consumption.
In `@tests/cypress/e2e/Forms/formPageDataValidation.cy.js`:
- Around line 176-181: The removed ESLint disables left a Chai property-getter
assertion (expect(...).to.exist.and.not.be.empty) that still triggers
no-unused-expressions; replace the property-chain with explicit assertion calls
to avoid property getters — for example, capture the asserted value into a
variable and use expect(value).to.exist; expect(value).to.not.be.empty; or use
expect(value).to.have.length.greaterThan(0) or assert.exists(value) — update the
test containing the expect(...).to.exist.and.not.be.empty expression
accordingly.
---
Nitpick comments:
In @.github/workflows/jscs.yml:
- Line 37: The CI job currently runs "npm ci --include=dev --legacy-peer-deps"
which uses --legacy-peer-deps as a temporary bypass; locate the run step in the
jscs workflow and remove the --legacy-peer-deps flag, replace it with a short
TODO comment and create a tracking issue to resolve underlying peer conflicts;
then add explicit package.json "overrides" entries for the conflicting packages
(or update dependency versions) so the workflow can run without
--legacy-peer-deps, and once verified remove the TODO and flag entirely.
In @.github/workflows/stylelint.yml:
- Line 22: The workflow currently sets node-version: "22" which floats across
patch releases; change the node-version value in the
.github/workflows/stylelint.yml (the node-version key in that job definition) to
a pinned patch release like "22.14.0" (or whichever specific 22.x.y you want) to
ensure reproducible CI runs.
- Line 37: Remove the temporary --legacy-peer-deps flag from the workflow step
that runs "npm ci --include=dev --legacy-peer-deps" and instead run "npm ci
--include=dev" once peer deps are reconciled; open a follow-up issue (e.g.,
"Audit peer dependencies for ESLint 9 and remove --legacy-peer-deps from
stylelint workflow") to track fixing incompatible peer ranges in package.json,
and add a short TODO comment next to the npm ci run step referencing that issue
so the removal is tracked.
In `@eslint.config.mjs`:
- Around line 70-71: Remove the redundant explicit globals "window" and
"document" from the ESLint config since you already spread globals.browser into
the globals object (see the existing globals.browser spread); delete the
separate "window" and "document" entries so they aren't duplicated and rely on
globals.browser's 'readonly' definitions instead.
- Line 114: Replace the deprecated unicornPlugin.configs['flat/all'] usage with
the canonical unicornPlugin.configs.all in the ESLint flat config; locate where
unicornPlugin.configs['flat/all'] is referenced (the array of extended configs)
and update it to unicornPlugin.configs.all, keeping the same import/name
(unicornPlugin) so the replacement is a direct swap with no other changes.
In `@js/src/core/factory/createPageElements.js`:
- Line 31: Update the JSDoc for the createPageElements function: remove the
side-effect description from the `@returns` {void} tag (leave it as just void or
"Nothing") and move the text "Updates the elements object by merging the new
elements into it." into the main JSDoc description/body above the tags so the
return tag only documents the absence of a return value; locate and edit the
JSDoc block for createPageElements in createPageElements.js.
In `@js/src/web-components/frm-web-component.js`:
- Around line 36-38: Update the three JSDoc blocks that still use the
single-star comment style and the old `@return` tag to the standard JSDoc format:
change the opening comment to /** ... */ and replace `@return` with `@returns` so
they match the existing update; specifically fix the block whose description is
"Load the component style." and the two other JSDoc blocks noted in the file
(the remaining `@return` occurrences) so all JSDoc comments use /** and `@returns`
consistently.
In `@package.json`:
- Around line 80-81: Update the package.json devDependencies entries for eslint
and eslint-import-resolver-node from exact pins to caret ranges so they match
the other packages; change "eslint": "9.39.2" to "eslint": "^9.39.2" and
"eslint-import-resolver-node": "0.3.9" to "eslint-import-resolver-node":
"^0.3.9" and run your lockfile install to persist the change.
| "no-invalid-position-at-import-rule": null, | ||
| "font-family-no-missing-generic-family-keyword": null, | ||
| "scss/at-import-no-partial-leading-underscore": null | ||
| "scss/at-import-no-partial-leading-underscore": null, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check stylelint-scss version in package.json
fd --type f "package.json" --max-depth 1 --exec cat {} \; | grep -A 2 -B 2 '"stylelint-scss"'Repository: Strategy11/formidable-forms
Length of output: 53
🏁 Script executed:
#!/bin/bash
# Read .stylelintrc.json around lines 30-35 to see both rules in context
head -40 .stylelintrc.json | tail -15Repository: Strategy11/formidable-forms
Length of output: 484
🏁 Script executed:
#!/bin/bash
# Try a simpler approach to find package.json and stylelint-scss version
find . -maxdepth 2 -name "package.json" -type f -exec cat {} \; 2>/dev/null | python3 << 'EOF'
import json
import sys
try:
data = json.load(sys.stdin)
if 'devDependencies' in data and 'stylelint-scss' in data['devDependencies']:
print(f"stylelint-scss version: {data['devDependencies']['stylelint-scss']}")
elif 'dependencies' in data and 'stylelint-scss' in data['dependencies']:
print(f"stylelint-scss version: {data['dependencies']['stylelint-scss']}")
else:
print("stylelint-scss not found in dependencies")
except json.JSONDecodeError:
print("Error parsing JSON")
EOFRepository: Strategy11/formidable-forms
Length of output: 89
🌐 Web query:
stylelint-scss deprecation "at-import-no-partial-leading-underscore" v6.0
💡 Result:
scss/at-import-no-partial-leading-underscore is deprecated (it was deprecated when scss/load-no-partial-leading-underscore was introduced) and you should migrate to:
scss/load-no-partial-leading-underscore(covers@import,@use,@forward, andmeta.load-css) [1], [2]
It was not removed in v6.0—it remained available (but deprecated) throughout the v6.x line; the deprecated at-import-* rules were removed in v7.0.0 [3]. If you saw a warning mentioning “removed in v6.0”, that aligns with a known issue: in v6.2.0 they fixed the version number in the deprecation message for at-import-no-partial-leading-underscore [4].
Migration (Stylelint config):
- Replace
"scss/at-import-no-partial-leading-underscore": true - With
"scss/load-no-partial-leading-underscore": true[1], [2]
Sources: [1] [2] [3] [4]
🏁 Script executed:
#!/bin/bash
# Simple grep approach for stylelint-scss version
grep -r "stylelint-scss" package.json 2>/dev/null || echo "Could not find stylelint-scss version"Repository: Strategy11/formidable-forms
Length of output: 108
Remove the deprecated scss/at-import-no-partial-leading-underscore rule.
at-import-no-partial-leading-underscore is deprecated and will be removed in v7.0.0; the replacement is load-no-partial-leading-underscore. Since line 33 already includes the replacement rule, line 32 is redundant and should be removed.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.stylelintrc.json at line 32, Remove the deprecated scss rule
"scss/at-import-no-partial-leading-underscore" from the .stylelintrc.json
configuration (it is redundant because the replacement
"scss/load-no-partial-leading-underscore" is already present); simply delete the
"scss/at-import-no-partial-leading-underscore" entry so only
"scss/load-no-partial-leading-underscore" remains.
| }, | ||
|
|
||
| // WordPress recommended-with-formatting preset | ||
| ...( wordpressPlugin.configs?.['flat/recommended-with-formatting'] ?? [] ), |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, check if eslint.config.mjs exists and read the relevant sections
cat -n eslint.config.mjs | head -100Repository: Strategy11/formidable-forms
Length of output: 3284
🏁 Script executed:
# Check the plugins block around lines 79-89
cat -n eslint.config.mjs | sed -n '45p;79,89p'Repository: Strategy11/formidable-forms
Length of output: 488
🏁 Script executed:
# Run the WordPress preset inspection script as suggested in the review
node -e "
const wp = require('./node_modules/@wordpress/eslint-plugin/index.js');
const preset = wp.configs?.['flat/recommended-with-formatting'] ?? [];
const configs = Array.isArray(preset) ? preset : [preset];
const pluginKeys = [];
configs.forEach((cfg, i) => {
if (cfg && cfg.plugins) {
Object.keys(cfg.plugins).forEach(k => pluginKeys.push(k));
}
});
console.log('WordPress preset plugin keys:', [...new Set(pluginKeys)]);
"Repository: Strategy11/formidable-forms
Length of output: 946
🏁 Script executed:
# Read more of the file to see lines 102, 112, 114, and 70-71 context
cat -n eslint.config.mjs | sed -n '60,120p'Repository: Strategy11/formidable-forms
Length of output: 2073
🏁 Script executed:
# Check package.json to understand versions of these plugins
cat package.json | head -50Repository: Strategy11/formidable-forms
Length of output: 2556
🌐 Web query:
@wordpress/eslint-plugin flat/recommended-with-formatting plugin registration
💡 Result:
@wordpress/eslint-plugin (as published on npm) does not expose a Flat Config export like configs["flat/recommended-with-formatting"]; its recommended-with-formatting preset is still an eslintrc-style config (it contains extends: [...] and plugins: [...]).[1][2] In ESLint Flat Config, that means there’s nothing to “register” as flat/recommended-with-formatting—you need to convert the legacy preset.
Use FlatCompat:
// eslint.config.mjs
import { FlatCompat } from '@eslint/eslintrc';
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
export default [
...compat.extends('plugin:`@wordpress/eslint-plugin/recommended-with-formatting`'),
];This is the intended migration path when a plugin hasn’t added configs["flat/..."] entries yet.[3]
Sources:
[1] recommended-with-formatting is eslintrc-style (shows extends + plugins): https://app.unpkg.com/@wordpress/eslint-plugin@21.0.0/files/configs/recommended-with-formatting.js
[2] WordPress package docs mention recommended-with-formatting (but not a flat config export): https://developer.wordpress.org/block-editor/reference-guides/packages/packages-eslint-plugin/
[3] ESLint plugin/flat-config guidance (configs["flat/..."] pattern and migration): https://eslint.org/docs/latest/extend/plugins and https://eslint.org/docs/latest/extend/plugin-migration-flat-config
🌐 Web query:
eslint-plugin-react flat config API recommended
💡 Result:
eslint-plugin-react exposes flat-config shareable configs on the root import:
reactPlugin.configs.flat.recommendedreactPlugin.configs.flat['jsx-runtime'](add if you use the React 17+ JSX transform)reactPlugin.configs.flat.all(github.com)
Minimal eslint.config.js (CommonJS)
const reactPlugin = require("eslint-plugin-react");
const globals = require("globals");
module.exports = [
{
files: ["**/*.{js,mjs,cjs,jsx,ts,tsx}"],
...reactPlugin.configs.flat.recommended,
// optionally also:
// ...reactPlugin.configs.flat["jsx-runtime"],
languageOptions: {
...reactPlugin.configs.flat.recommended.languageOptions,
globals: {
...globals.browser,
},
},
},
];Notes:
reactPlugin.configs.flat.recommendedis a config object (not the plugin object), and the plugin’s shareable flat configs don’t setfilesorlanguageOptions.globals, so you typically add those yourself. (github.com)- In the ESLint ecosystem, some plugins expose flat configs as objects vs arrays; ESLint’s docs/blog call out that
eslint-plugin-reactexposesreactPlugin.configs.flat.recommendedin this “object-style”. (eslint.org)
Citations:
- 1: https://github.com/jsx-eslint/eslint-plugin-react
- 2: https://github.com/jsx-eslint/eslint-plugin-react
- 3: https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/
🌐 Web query:
eslint-plugin-unicorn configs flat/all deprecated
💡 Result:
In eslint-plugin-unicorn, the preset configs with the flat/ prefix are deprecated:
eslintPluginUnicorn.configs['flat/all']→ deprecated, useeslintPluginUnicorn.configs.allinstead (theflat/prefix is “no longer needed”). [1]eslintPluginUnicorn.configs['flat/recommended']→ deprecated, useeslintPluginUnicorn.configs.recommendedinstead. [1]
The plugin still exports the flat/* keys temporarily “to avoid breaking users,” but they’re intended to be removed eventually. [2]
Example (recommended):
import unicorn from 'eslint-plugin-unicorn';
export default [
unicorn.configs.all, // instead of unicorn.configs['flat/all']
// or: unicorn.configs.recommended
];Sources: [1] [2]
🏁 Script executed:
# Check full file length and read end sections
wc -l eslint.config.mjsRepository: Strategy11/formidable-forms
Length of output: 92
🏁 Script executed:
# Check if the WordPress preset actually works (does the ?? fallback mask the issue?)
cat -n eslint.config.mjs | grep -A 5 -B 5 "wordpressPlugin"Repository: Strategy11/formidable-forms
Length of output: 816
Fix WordPress preset integration—the flat config export does not exist and FlatCompat is required.
@wordpress/eslint-plugin does not expose configs["flat/recommended-with-formatting"] as a flat config export; the recommended-with-formatting preset is eslintrc-style only. Line 45's access to this non-existent key falls back to an empty array (due to the ?? operator), meaning WordPress rules are never loaded. Use FlatCompat to migrate the eslintrc preset to flat config format as documented in the ESLint plugin migration guide.
Also:
- Line 102:
reactPlugin.configs.recommended.rulesuses eslintrc-style API; use flat config APIreactPlugin.configs.flat.recommendedinstead. - Line 114:
unicornPlugin.configs['flat/all']is deprecated; useunicornPlugin.configs.allinstead. - Lines 70–71:
windowanddocumentare redundant; they are already included inglobals.browser.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@eslint.config.mjs` at line 45, Replace the direct access to the non-existent
flat preset from the WordPress plugin by instantiating ESLint's FlatCompat and
using it to convert the eslintrc-style preset: import { FlatCompat } from
"@eslint/eslintrc" and call new FlatCompat({ baseDirectory: __dirname
}).compat(wordpressPlugin.configs["recommended-with-formatting"]) instead of
reading configs["flat/recommended-with-formatting"]; also update React and
Unicorn usages to their flat-style configs by switching
reactPlugin.configs.recommended.rules to reactPlugin.configs.flat.recommended
and unicornPlugin.configs['flat/all'] to unicornPlugin.configs.all; finally
remove explicit window and document globals since globals.browser already covers
them (remove window/document from the globals export).
| }, | ||
| rules: { | ||
| // React recommended | ||
| ...reactPlugin.configs.recommended.rules, |
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and read the relevant section
find . -name "eslint.config.mjs" -type fRepository: Strategy11/formidable-forms
Length of output: 90
🏁 Script executed:
# Run the verification script from the review comment
#!/bin/bash
if [ -f "./node_modules/eslint-plugin-react/index.js" ]; then
node -e "
const r = require('./node_modules/eslint-plugin-react/index.js');
console.log('=== eslint-plugin-react API ===');
console.log('configs.flat exists:', !!r.configs?.flat);
console.log('configs.flat keys:', Object.keys(r.configs?.flat ?? {}));
console.log('configs.recommended exists:', !!r.configs?.recommended);
console.log('configs keys:', Object.keys(r.configs ?? {}));
console.log('Full configs structure:', JSON.stringify(r.configs ?? {}, null, 2).substring(0, 500));
"
else
echo "eslint-plugin-react not found in node_modules"
# Check package.json for dependency
if [ -f "package.json" ]; then
echo "Checking package.json for eslint-plugin-react..."
grep -i "eslint-plugin-react" package.json || echo "Not found in package.json"
fi
fiRepository: Strategy11/formidable-forms
Length of output: 201
🏁 Script executed:
# Read the eslint.config.mjs file around line 102
if [ -f "./eslint.config.mjs" ]; then
echo "=== eslint.config.mjs content (with context around line 102) ==="
wc -l ./eslint.config.mjs
# Show lines 90-115 for context
sed -n '90,115p' ./eslint.config.mjs | cat -n
else
echo "eslint.config.mjs not found"
fiRepository: Strategy11/formidable-forms
Length of output: 1101
🏁 Script executed:
# Check ESLint version and other relevant dependencies
grep -E "(eslint|eslint-plugin-react)" package.json | head -20Repository: Strategy11/formidable-forms
Length of output: 727
🌐 Web query:
eslint-plugin-react 7.37.5 flat config API docs
💡 Result:
eslint-plugin-react@7.37.5 documents its flat config API in the repo README under “Configuration (new: eslint.config.js)” → “Flat Configs”. (github.com)
What it exports (flat config)
From the root plugin import, it exports three flat configs:
reactPlugin.configs.flat.allreactPlugin.configs.flat.recommendedreactPlugin.configs.flat['jsx-runtime'](github.com)
These flat configs configure the plugin under the react/ namespace and enable JSX via languageOptions.parserOptions.ecmaFeatures.jsx. (github.com)
Usage example (eslint.config.js)
const reactPlugin = require('eslint-plugin-react');
module.exports = [
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat['jsx-runtime'], // add if using React 17+ new JSX transform
];Citations:
- 1: https://github.com/jsx-eslint/eslint-plugin-react?utm_source=openai
- 2: https://github.com/jsx-eslint/eslint-plugin-react?utm_source=openai
- 3: https://github.com/jsx-eslint/eslint-plugin-react?utm_source=openai
- 4: https://github.com/jsx-eslint/eslint-plugin-react?utm_source=openai
🌐 Web query:
eslint-plugin-react v7 flat config support
💡 Result:
Yes—eslint-plugin-react v7 supports ESLint Flat Config.
- It exports three flat configs:
flat.all,flat.recommended, andflat['jsx-runtime'](available from the root plugin import). [1] - Example
eslint.config.jsusage (CommonJS), straight from the plugin docs: [1]const reactPlugin = require('eslint-plugin-react'); module.exports = [ reactPlugin.configs.flat.recommended, reactPlugin.configs.flat['jsx-runtime'], // add if using React 17+ ];
Also note: ESLint v9 uses flat config by default (and deprecates .eslintrc). [2]
Sources: [1] eslint-plugin-react README (GitHub) • [2] ESLint v9.0.0 release post
Use reactPlugin.configs.flat.recommended flat config instead of the legacy eslintrc-format config.
The current code spreads only .recommended.rules, which bypasses the flat config's languageOptions, settings, and plugins entries. For ESLint 9 with flat config, use the full reactPlugin.configs.flat.recommended config object at the top-level export array alongside the WordPress preset, rather than just its .rules within a nested config.
♻️ Suggested approach
export default [
...( wordpressPlugin.configs?.['flat/recommended-with-formatting'] ?? [] ),
+ ...( reactPlugin.configs?.flat?.recommended ? [ reactPlugin.configs.flat.recommended ] : [] ),
{
files: ['**/*.js', '**/*.jsx', '**/*.mjs'],
...
rules: {
- // React recommended
- ...reactPlugin.configs.recommended.rules,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@eslint.config.mjs` at line 102, The config currently spreads only
reactPlugin.configs.flat.recommended.rules which omits languageOptions,
settings, and plugins from the flat config; replace that spread with the full
flat config by adding reactPlugin.configs.flat.recommended as a top-level entry
in the exported array alongside the WordPress preset (instead of nesting only
.rules), ensuring the file's export uses the complete
reactPlugin.configs.flat.recommended object so languageOptions, settings and
plugins are preserved.
| // No-jquery deprecated | ||
| ...( noJqueryPlugin.configs?.deprecated?.rules ?? {} ), | ||
| // Compat recommended | ||
| ...( compatPlugin.configs?.['flat/recommended']?.[0]?.rules ?? compatPlugin.configs?.recommended?.rules ?? {} ), |
There was a problem hiding this comment.
[0]?.rules silently drops rules from any subsequent config objects in the compat flat array.
compatPlugin.configs['flat/recommended'] is likely an array of config objects. Accessing [0]?.rules only extracts the rules of the first element; if the plugin spreads rules across multiple objects (e.g., a language-options object + a rules object), everything after index 0 is silently discarded.
♻️ Suggested fix
Collect rules from all config objects in the array:
- ...( compatPlugin.configs?.['flat/recommended']?.[0]?.rules ?? compatPlugin.configs?.recommended?.rules ?? {} ),
+ ...( [].concat( compatPlugin.configs?.['flat/recommended'] ?? [] ).reduce( ( acc, cfg ) => ({ ...acc, ...( cfg?.rules ?? {} ) }), {} ) || compatPlugin.configs?.recommended?.rules ?? {} ),Or, more cleanly, spread the entire flat preset in the outer array alongside the WordPress preset and omit the inline rules spread entirely.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@eslint.config.mjs` at line 112, The current code only reads
compatPlugin.configs['flat/recommended'][0]?.rules which drops rules from later
config objects in the flat preset; update the logic where
compatPlugin.configs['flat/recommended'] is consumed (the place referencing
[0]?.rules) to either (A) merge rules from all config objects in the array by
iterating the array and Object.assign/merge each .rules into a single rules
object, or (B) simpler: spread the entire
compatPlugin.configs['flat/recommended'] array into the outer flat config
alongside the WordPress preset and remove the inline [.rules] spread so you
don’t lose later config objects—adjust the code that currently accesses
[0]?.rules (refer to compatPlugin.configs['flat/recommended']) accordingly.
| * | ||
| * @param {string} name - The name of the cookie. | ||
| * @return {string|null} The value of the cookie, or undefined if the cookie does not exist. | ||
| * @returns {string|null} The value of the cookie, or undefined if the cookie does not exist. |
There was a problem hiding this comment.
Doc inconsistency: {string|null} type vs. "or undefined" in the description.
The return type annotation says {string|null} but the description reads "or undefined if the cookie does not exist." These should agree — either update the type to {string|undefined} (matching the actual Array.prototype.find return, which yields undefined when nothing is found) or fix the description.
📝 Proposed fix
- * `@returns` {string|null} The value of the cookie, or undefined if the cookie does not exist.
+ * `@returns` {string|undefined} The value of the cookie, or undefined if the cookie does not exist.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@js/admin/dom.js` at line 458, The JSDoc return type `{string|null}` is
inconsistent with the implementation which uses Array.prototype.find (returns
`undefined` if not found) and the description that says "or undefined"; update
the JSDoc for the cookie-getting function (e.g., getCookie / the function that
parses document.cookie and uses .find) to `@returns {string|undefined}` to match
actual behavior, or alternatively change the description to say "or null" if you
change the implementation to return `null`; ensure the doc matches the symbol
that does the find and that no code paths actually return `null`.
| }; | ||
| requestAnimationFrame( step ); | ||
| /* eslint-enable compat/compat */ | ||
|
|
There was a problem hiding this comment.
Potential trailing whitespace left behind after ESLint comment removal.
Line 1729 is a blank line marked as modified (~), following the same pattern as the previously-addressed trailing-whitespace issues on lines 1721/1731. Please verify there is no residual tab/space character remaining here.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@js/formidable.js` at line 1729, There is a residual trailing whitespace on
the blank line left after removing an ESLint comment; open js/formidable.js
around the blank area that follows the ESLint-comment removal (the same region
as the previously-fixed trailing-whitespace instances) and delete any spaces or
tabs on that empty line so it is truly empty, then save/run the formatter or
ESLint autofix to ensure no trailing whitespace remains.
| const MAX_FIELD_GROUP_SIZE = 12; | ||
|
|
||
| const frmAdminJs = frm_admin_js; // eslint-disable-line camelcase | ||
| const frmAdminJs = frm_admin_js; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
rg -n 'frm_admin_js' js/src/admin/admin.jsRepository: Strategy11/formidable-forms
Length of output: 631
Incomplete migration: frm_admin_js still referenced directly after alias is introduced
frmAdminJs is introduced on line 239 to satisfy the now-enforced camelcase rule, but the global frm_admin_js is still used directly in four places in the same file:
| Line | Usage |
|---|---|
| 4866 | frm_admin_js.holdShiftMsg |
| 6373 | frm_admin_js.no_label |
| 7101 | frm_admin_js.noTitleText |
| 11293 | frm_admin_js.import_complete |
Update these four usages to reference frmAdminJs instead of frm_admin_js for consistency.
Proposed fix
- frm_admin_js.holdShiftMsg,
+ frmAdminJs.holdShiftMsg,
- label = '' !== saved ? saved : frm_admin_js.no_label;
+ label = '' !== saved ? saved : frmAdminJs.no_label;
- return 'true' === urlParams.get( 'new_template' ) && document.querySelector( '#frm_top_bar `#frm_bs_dropdown` .frm_bstooltip' )?.textContent.trim() === frm_admin_js.noTitleText;
+ return 'true' === urlParams.get( 'new_template' ) && document.querySelector( '#frm_top_bar `#frm_bs_dropdown` .frm_bstooltip' )?.textContent.trim() === frmAdminJs.noTitleText;
- jQuery( document.getElementById( 'frm_import_message' ) ).html( frm_admin_js.import_complete );
+ jQuery( document.getElementById( 'frm_import_message' ) ).html( frmAdminJs.import_complete );🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@js/src/admin/admin.js` at line 239, The file introduced the camelCase alias
frmAdminJs but left four direct references to the old global frm_admin_js;
update the four usages (the properties holdShiftMsg, no_label, noTitleText,
import_complete) to use frmAdminJs instead of frm_admin_js so all accesses are
consistent. Locate occurrences of frm_admin_js.holdShiftMsg,
frm_admin_js.no_label, frm_admin_js.noTitleText, and
frm_admin_js.import_complete and replace them with frmAdminJs.holdShiftMsg,
frmAdminJs.no_label, frmAdminJs.noTitleText, and frmAdminJs.import_complete
respectively, ensuring you do not change property names or surrounding logic.
| * @param {Function} options.easing Easing function (default: easeOutQuart) | ||
| * @throws {Error} When element is not found or invalid | ||
| * @return {HTMLElement} The updated element for method chaining | ||
| * @returns {HTMLElement} The updated element for method chaining |
There was a problem hiding this comment.
@returns type should be {HTMLElement|null}.
The counter function returns null at line 18 when the element is not found or is not a valid HTMLElement, so {HTMLElement} alone is inaccurate.
📝 Proposed fix
- * `@returns` {HTMLElement} The updated element for method chaining
+ * `@returns` {HTMLElement|null} The updated element for method chaining, or null if element not found📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * @returns {HTMLElement} The updated element for method chaining | |
| * `@returns` {HTMLElement|null} The updated element for method chaining, or null if element not found |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@js/src/core/ui/counter.js` at line 10, Update the JSDoc for the counter
function to reflect that it may return null: change the `@returns` annotation from
{HTMLElement} to {HTMLElement|null} so it matches the runtime behavior in the
counter function (which returns null when the element is not found or is not a
valid HTMLElement). Ensure the comment sits above the counter function
declaration and maintain existing description text.
| * Initializes the view. | ||
| * | ||
| * @return {Element} - The wrapper element. | ||
| * @returns {Element} - The wrapper element. |
There was a problem hiding this comment.
Return types are missing the null case.
initView(Line 14) explicitly returnsnullon Line 19 whenthis.tabs.length === 0, so{Element}should be{Element|null}.getTabUnderline(Line 146) delegates toshadowRoot.querySelector(...), which has a return type ofElement | null.
📝 Proposed type corrections
- * `@returns` {Element} - The wrapper element.
+ * `@returns` {Element|null} - The wrapper element.- * `@returns` {Element} - The tab underline.
+ * `@returns` {Element|null} - The tab underline.Also applies to: 146-146
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@js/src/web-components/frm-tab-navigator-component/frm-tab-navigator-component.js`
at line 14, Update the JSDoc return annotations to include the null case for
functions that can return null: change the `@returns` for initView to
{Element|null} (since initView explicitly returns null when this.tabs.length ===
0) and change the `@returns` for getTabUnderline to {Element|null} (it calls
shadowRoot.querySelector which may return null); locate the JSDoc blocks above
initView and getTabUnderline in frm-tab-navigator-component.js and append
"|null" to their return types so the docs/types accurately reflect possible null
returns.
| * Gets the tab delimiter. | ||
| * | ||
| * @return {string} - The tab delimiter. | ||
| * @returns {string} - The tab delimiter. |
There was a problem hiding this comment.
@returns {string} is incorrect — these methods return DOM Element objects.
All five methods (getTabDelimiter, getTabs, getTabContainer, createTabHeading, createTabContainer) return values created via document.createElement(...), not strings. The type annotation was wrong before and the migration to @returns preserved the error.
📝 Proposed type corrections
- * `@returns` {string} - The tab delimiter.
+ * `@returns` {Element} - The tab delimiter.- * `@returns` {string} - The tab headings.
+ * `@returns` {Element} - The tab headings.- * `@returns` {string} - The tab container.
+ * `@returns` {Element} - The tab container.- * `@returns` {string} - The tab heading.
+ * `@returns` {Element} - The tab heading.- * `@returns` {string} - The tab container.
+ * `@returns` {Element} - The tab container.Also applies to: 72-72, 91-91, 113-113, 128-128
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@js/src/web-components/frm-tab-navigator-component/frm-tab-navigator-component.js`
at line 55, Update the JSDoc return types for the five methods that return DOM
elements: change the incorrect `@returns` {string} to an appropriate DOM type
(e.g., `@returns` {HTMLElement} or a more specific type like {HTMLDivElement} /
{HTMLSpanElement}) for getTabDelimiter, getTabs, getTabContainer,
createTabHeading, and createTabContainer to reflect that they return values
created by document.createElement(...) rather than strings; ensure each method's
`@returns` matches the actual element created (e.g., if createTabHeading uses
document.createElement('div') use {HTMLDivElement}).
Summary by CodeRabbit