Change the JavaScript code to follow the Drupal coding standards

Created on 19 July 2023, over 1 year ago
Updated 25 August 2023, about 1 year ago

Problem/Motivation

Currently, we are having a lot of coding standard problems in the JS file that are need fixing.

Proposed resolution

Fix the coding standard issues including variable types from var to let where it is contextually make sense.

Remaining tasks

  • ✅ Get maintainer approval for the proposed resolution
  • ✅ Implement resolution
  • ✅ Write test coverage (contact a maintainer if you need help)
  • ✅ Maintainer review via the UI
  • ❌ Maintainer Code Review #1
  • ❌ Maintainer code review #2
  • ❌ Merge into dev branch, with credit to author and participants
📌 Task
Status

Needs review

Version

2.1

Component

Code

Created by

🇧🇪Belgium joevagyok

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joevagyok
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.5 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    6 pass
  • 🇦🇷Argentina tguerineau

    In order to address the issue I made the following changes:

    - Refactored the JavaScript code to resolve ESLint errors, Used eslint for Drupal JS coding standards .
    - Simplified the initialization of the ml variable within the local script scope.

    Manual Testing:

    - Checked the retention of the previous maxlength value set on a field, including summaries.
    - Verified the saving of maxlength settings.
    - Ensured that each maxlength limit method operates as expected.
    - Confirmed that changing maxlength limit methods works correctly.
    - Tested updating from the latest release to the newest version of the main branch and didn't encounter any issues.

    Observations:

    -I observed the code pattern const ml = ml || {}; which gives an impression that ml might be a global variable. However, after thoroughly checking the module's directory and the broader codebase, I didn't find any external declarations for ml.
    -I've refactored the code to initialize ml only within the local scope of our script. Manual tests seem fine, but I'd appreciate if reviewers can validate this change and ensure there's no hidden dependency on a global ml.

  • 🇺🇸United States cedewey Denver, CO
  • Assigned to hbrokmeier
  • 🇺🇸United States cedewey Denver, CO

    Hi Tom'as,

    Thanks so much for working on this issue! I tested your patch manually and it all works as expected.

    Assigning to Heather for a code review.

Production build 0.71.5 2024