Fix Javascript Coding standards issues

Created on 7 June 2024, 21 days ago
Updated 21 June 2024, 7 days ago

Problem/Motivation

/builds/project/datetime_now/web/modules/custom/datetime_now/js/datetime_now.js
   7:3   error  'use strict' is unnecessary inside of modules                                                                                                                                                        strict
   9:3   error  Date prototype is read only, properties should not be added                                                                                                                                          no-extend-native
   9:49  error  Insert `·`                                                                                                                                                                                           prettier/prettier
  10:9   error  'local' is never reassigned. Use 'const' instead                                                                                                                                                     prefer-const
  12:35  error  Insert `·`                                                                                                                                                                                           prettier/prettier
  15:3   error  Date prototype is read only, properties should not be added                                                                                                                                          no-extend-native
  15:49  error  Insert `·`                                                                                                                                                                                           prettier/prettier
  16:9   error  'local' is never reassigned. Use 'const' instead                                                                                                                                                     prefer-const
  19:9   error  'time' is never reassigned. Use 'const' instead                                                                                                                                                      prefer-const
  25:26  error  Insert `·`                                                                                                                                                                                           prettier/prettier
  34:5   error  Expected method shorthand                                                                                                                                                                            object-shorthand
  35:70  error  Replace `function` with `⏎········function·`                                                                                                                                                         prettier/prettier
  36:1   error  Replace `········` with `··········`                                                                                                                                                                 prettier/prettier
  36:13  error  '$wrapper' is never reassigned. Use 'const' instead                                                                                                                                                  prefer-const
  37:1   error  Insert `··`                                                                                                                                                                                          prettier/prettier
  37:13  error  Identifier '$now_button' is not in camel case                                                                                                                                                        camelcase
  37:13  error  '$now_button' is never reassigned. Use 'const' instead                                                                                                                                               prefer-const
  39:9   error  Replace `$now_button.on('click',·function(e)` with `··$now_button.on('click',·function·(e)·`                                                                                                         prettier/prettier
  39:9   error  Identifier '$now_button' is not in camel case                                                                                                                                                        camelcase
  40:11  error  Insert `··`                                                                                                                                                                                          prettier/prettier
  40:15  error  'date' is never reassigned. Use 'const' instead                                                                                                                                                      prefer-const
  40:22  error  Unexpected string concatenation                                                                                                                                                                      prefer-template
  41:1   error  Insert `··`                                                                                                                                                                                          prettier/prettier
  41:15  error  'time' is never reassigned. Use 'const' instead                                                                                                                                                      prefer-const
  41:22  error  Unexpected string concatenation                                                                                                                                                                      prefer-template
  42:11  error  Replace `let·$date_element·=·$wrapper.find('[data-drupal-selector="'·+·date·+·'"]'` with `··let·$date_element·=·$wrapper.find(⏎··············'[data-drupal-selector="'·+·date·+·'"]',⏎············`  prettier/prettier
  42:15  error  Identifier '$date_element' is not in camel case                                                                                                                                                      camelcase
  42:15  error  '$date_element' is never reassigned. Use 'const' instead                                                                                                                                             prefer-const
  42:45  error  Unexpected string concatenation                                                                                                                                                                      prefer-template
  43:11  error  Replace `let·$time_element·=·$wrapper.find('[data-drupal-selector="'·+·time·+·'"]'` with `··let·$time_element·=·$wrapper.find(⏎··············'[data-drupal-selector="'·+·time·+·'"]',⏎············`  prettier/prettier
  43:15  error  Identifier '$time_element' is not in camel case                                                                                                                                                      camelcase
  43:15  error  '$time_element' is never reassigned. Use 'const' instead                                                                                                                                             prefer-const
  43:45  error  Unexpected string concatenation                                                                                                                                                                      prefer-template
  45:1   error  Insert `··`                                                                                                                                                                                          prettier/prettier
  45:15  error  'step' is never reassigned. Use 'const' instead                                                                                                                                                      prefer-const
  45:22  error  Identifier '$time_element' is not in camel case                                                                                                                                                      camelcase
  46:11  error  Insert `··`                                                                                                                                                                                          prettier/prettier
  46:15  error  'today' is never reassigned. Use 'const' instead                                                                                                                                                     prefer-const
  47:1   error  Replace `··········` with `············`                                                                                                                                                             prettier/prettier
  47:15  error  'now' is never reassigned. Use 'const' instead                                                                                                                                                       prefer-const
  49:11  error  Insert `··`                                                                                                                                                                                          prettier/prettier
  49:11  error  Identifier '$date_element' is not in camel case                                                                                                                                                      camelcase
  49:11  error  Prefer value to $.val                                                                                                                                                                                jquery/no-val
  50:1   error  Replace `··········` with `············`                                                                                                                                                             prettier/prettier
  50:11  error  Identifier '$time_element' is not in camel case                                                                                                                                                      camelcase
  50:11  error  Prefer value to $.val                                                                                                                                                                                jquery/no-val
  52:1   error  Insert `··`                                                                                                                                                                                          prettier/prettier
  53:9   error  Insert `··`                                                                                                                                                                                          prettier/prettier
  54:7   error  Replace `}` with `··},⏎······`                                                                                                                                                                       prettier/prettier
  55:6   error  Insert `,`                                                                                                                                                                                           prettier/prettier
  56:5   error  Delete `⏎`                                                                                                                                                                                           prettier/prettier
✖ 51 problems (51 errors, 0 warnings)
  40 errors and 0 warnings potentially fixable with the `--fix` option.
$ printf "$DIVIDER\nNow running ESLINT using the --fix option. Any errors shown below are not fixable automatically.$DIVIDER\n"
 
*****************************************************************************************************************************
Now running ESLINT using the --fix option. Any errors shown below are not fixable automatically. 
*****************************************************************************************************************************
$ $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 --fix . || EXIT_CODE_FIX=$?
/builds/project/datetime_now/web/modules/custom/datetime_now/js/datetime_now.js
   7:3   error  Date prototype is read only, properties should not be added  no-extend-native
  13:3   error  Date prototype is read only, properties should not be added  no-extend-native
  36:17  error  Identifier '$now_button' is not in camel case                camelcase
  38:11  error  Identifier '$now_button' is not in camel case                camelcase
  41:19  error  Identifier '$date_element' is not in camel case              camelcase
  44:19  error  Identifier '$time_element' is not in camel case              camelcase
  48:26  error  Identifier '$time_element' is not in camel case              camelcase
  52:13  error  Identifier '$date_element' is not in camel case              camelcase
  52:13  error  Prefer value to $.val                                        jquery/no-val
  53:13  error  Identifier '$time_element' is not in camel case              camelcase
  53:13  error  Prefer value to $.val                                        jquery/no-val
✖ 11 problems (11 errors, 0 warnings)

Steps to reproduce

https://git.drupalcode.org/project/datetime_now/-/jobs/1806924

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇺🇸United States generalredneck

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024