Fix issues reported by eslint

Created on 3 December 2024, 19 days ago

Problem/Motivation

With šŸ“Œ Integration with Gitlab CI Active in place, we can start checking for eslint. There is a report now for the issues we can fix.

*****************************************************************************************************************************
These are the current ESLint errors and warnings 
*****************************************************************************************************************************
$ $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/eslint --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$CI_PROJECT_DIR/$_WEB_ROOT/core --ext=.js,.yml $_ESLINT_EXTRA . || true
/builds/project/mask/web/modules/custom/mask/js/mask.js
   2:1   error  Delete `āŽ`                                                                                                                                                             prettier/prettier
   8:3   error  for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array  no-restricted-syntax
   8:3   error  The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype                                                             guard-for-in
   8:8   error  All 'var' declarations must be at the top of the function scope                                                                                                        vars-on-top
   8:8   error  Unexpected var, use let or const instead                                                                                                                               no-var
   9:5   error  All 'var' declarations must be at the top of the function scope                                                                                                        vars-on-top
   9:5   error  Unexpected var, use let or const instead                                                                                                                               no-var
  17:58  error  'maskElements' was used before it was defined                                                                                                                          no-use-before-define
  18:6   error  Insert `,`                                                                                                                                                             prettier/prettier
  23:11  error  Identifier 'mask_element' is not in camel case                                                                                                                         camelcase
  26:23  error  Identifier 'mask_element' is not in camel case                                                                                                                         camelcase
  28:16  error  Identifier 'mask_element' is not in camel case                                                                                                                         camelcase
  29:23  error  Insert `āŽĀ·Ā·Ā·Ā·Ā·Ā·Ā·`                                                                                                                                                      prettier/prettier
  29:24  error  Identifier 'mask_element' is not in camel case                                                                                                                         camelcase
  30:22  error  Identifier 'mask_element' is not in camel case                                                                                                                         camelcase
  31:51  error  Insert `,`                                                                                                                                                             prettier/prettier
  35:5   error  Identifier 'mask_element' is not in camel case                                                                                                                         camelcase
  37:35  error  Delete `Ā·`                                                                                                                                                             prettier/prettier
āœ– 18 problems (18 errors, 0 warnings)
  7 errors and 0 warnings potentially fixable with the `--fix` option.                                 

Steps to reproduce

See https://git.drupalcode.org/project/mask/-/jobs/3576796

Proposed resolution

-

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

šŸ“Œ Task
Status

Active

Version

2.1

Component

Code

Created by

šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ

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

Merge Requests

Comments & Activities

  • Issue created by @tim-diels
  • Pipeline finished with Failed
    18 days ago
    Total: 136s
    #358601
  • I have fixed the almost all the eslint errors ,
    Remaining warning are good to be resolved by the maintainer.
    Kindly review
    Thanks !!

  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ

    This should be done for the 2.1.x branch. I know the default was 2.0.x but I don't have the correct right to change. I'll ask the maintainer to change this.

  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ

    There are still 2 errors which can be fixed really easily. Why do you ask a maintainer to fix the remaining issues? You could ask some guidance in here or on slack on how to solve the remaining issues? I would love to see some more effort before I'm willing to give some credits as this seems an easy way to get a credit and shift the problem to someone else.

  • Pipeline finished with Failed
    16 days ago
    Total: 168s
    #361021
  • Pipeline finished with Failed
    16 days ago
    Total: 138s
    #361023
  • @tim-diels Now It's green for eslint errors.
    Kindly review

  • šŸ‡§šŸ‡ŖBelgium tim-diels Belgium šŸ‡§šŸ‡Ŗ

    Thanks for the great effort here @dhruv.mittal! Appreciated!
    Before I can accept code changes we should get šŸ“Œ Fix tests Active fixed so we know we're not breaking our automatic tests.
    I shall do a manual review also when we can see our tests don't fail already.

Production build 0.71.5 2024