Pass ESLint validations: JavaScript Example

Created on 27 January 2024, about 1 year ago
Updated 11 July 2024, 8 months ago

Problem/Motivation

At 📌 [Meta] Pass Eslint validations Active we are aiming to have all the eslint validation checks passing for the Examples module.

On this issue, we'll be focused on the js_example sub-module

Initial errors detected by 27/01/2024

modules/js_example/js/accordion.js
  1:1   error  Unexpected var, use let or const instead     no-var
  2:1   error  Unexpected var, use let or const instead     no-var
  3:6   error  'i' is not defined                           no-undef
  3:13  error  'i' is not defined                           no-undef
  3:31  error  'i' is not defined                           no-undef
  4:9   error  'i' is not defined                           no-undef
  4:38  error  'toggleItem' was used before it was defined  no-use-before-define
  7:3   error  Unexpected var, use let or const instead     no-var
  8:8   error  'i' is not defined                           no-undef
  8:15  error  'i' is not defined                           no-undef
  8:35  error  'i' is not defined                           no-undef
  9:13  error  'i' is not defined                           no-undef
/modules/js_example/js/black.js
   6:2   warning  Unexpected unnamed function                                                       func-names
   7:1   error    Delete `⏎`                                                                        prettier/prettier
   8:3   error    'use strict' is unnecessary inside of modules                                     strict
  14:5   warning  Unexpected unnamed method 'attach'                                                func-names
  14:5   error    Expected method shorthand                                                         object-shorthand
  15:7   error    Unexpected var, use let or const instead                                          no-var
  16:7   error    Unexpected var, use let or const instead                                          no-var
  16:36  error    Replace `.css('color',·'black')` with `⏎········.css('color',·'black')⏎········`  prettier/prettier
  16:64  error    Unexpected string concatenation                                                   prefer-template
  18:6   error    Insert `,`                                                                        prettier/prettier
modules/js_example/js/blue.js
   6:2   warning  Unexpected unnamed function                                                     func-names
   7:1   error    Delete `⏎`                                                                      prettier/prettier
   8:3   error    'use strict' is unnecessary inside of modules                                   strict
  14:5   warning  Unexpected unnamed method 'attach'                                              func-names
  14:5   error    Expected method shorthand                                                       object-shorthand
  15:7   error    Unexpected var, use let or const instead                                        no-var
  16:7   error    Unexpected var, use let or const instead                                        no-var
  16:36  error    Replace `.css('color',·'blue')` with `⏎········.css('color',·'blue')⏎········`  prettier/prettier
  16:63  error    Unexpected string concatenation                                                 prefer-template
  18:6   error    Insert `,`                                                                      prettier/prettier
modules/js_example/js/brown.js
   6:2   warning  Unexpected unnamed function                                                       func-names
   7:1   error    Delete `⏎`                                                                        prettier/prettier
   8:3   error    'use strict' is unnecessary inside of modules                                     strict
  14:5   warning  Unexpected unnamed method 'attach'                                                func-names
  14:5   error    Expected method shorthand                                                         object-shorthand
  15:7   error    Unexpected var, use let or const instead                                          no-var
  16:7   error    Unexpected var, use let or const instead                                          no-var
  16:36  error    Replace `.css('color',·'brown')` with `⏎········.css('color',·'brown')⏎········`  prettier/prettier
  16:64  error    Unexpected string concatenation                                                   prefer-template
  18:6   error    Insert `,`                                                                        prettier/prettier
modules/js_example/js/green.js
   6:2   warning  Unexpected unnamed function                                                       func-names
   7:1   error    Delete `⏎`                                                                        prettier/prettier
   8:3   error    'use strict' is unnecessary inside of modules                                     strict
  14:5   warning  Unexpected unnamed method 'attach'                                                func-names
  14:5   error    Expected method shorthand                                                         object-shorthand
  15:7   error    Unexpected var, use let or const instead                                          no-var
  16:7   error    Unexpected var, use let or const instead                                          no-var
  16:36  error    Replace `.css('color',·'green')` with `⏎········.css('color',·'green')⏎········`  prettier/prettier
  16:64  error    Unexpected string concatenation                                                   prefer-template
  18:6   error    Insert `,`                                                                        prettier/prettier
modules/js_example/js/purple.js
   6:2   warning  Unexpected unnamed function                                                         func-names
   7:1   error    Delete `⏎`                                                                          prettier/prettier
   8:3   error    'use strict' is unnecessary inside of modules                                       strict
  14:5   warning  Unexpected unnamed method 'attach'                                                  func-names
  14:5   error    Expected method shorthand                                                           object-shorthand
  15:7   error    Unexpected var, use let or const instead                                            no-var
  16:7   error    Unexpected var, use let or const instead                                            no-var
  16:36  error    Replace `.css('color',·'purple')` with `⏎········.css('color',·'purple')⏎········`  prettier/prettier
  16:65  error    Unexpected string concatenation                                                     prefer-template
  18:6   error    Insert `,`                                                                          prettier/prettier
modules/js_example/js/red.js
   6:2   warning  Unexpected unnamed function                                                   func-names
   7:1   error    Delete `⏎`                                                                    prettier/prettier
   8:3   error    'use strict' is unnecessary inside of modules                                 strict
  14:5   warning  Unexpected unnamed method 'attach'                                            func-names
  14:5   error    Expected method shorthand                                                     object-shorthand
  15:7   error    Unexpected var, use let or const instead                                      no-var
  16:7   error    Unexpected var, use let or const instead                                      no-var
  16:36  error    Replace `.css('color',·'red')` with `⏎········.css('color',·'red')⏎········`  prettier/prettier
  16:62  error    Unexpected string concatenation                                               prefer-template
  18:6   error    Insert `,`                                                                    prettier/prettier
/modules/js_example/js_example.libraries.yml
  12:3  error  Expected line before comment  lines-around-comment
  16:3  error  Expected line before comment  lines-around-comment
  18:5  error  Expected line before comment  lines-around-comment

Proposed resolution

  1. Check the parent issue for detailed instructions about how to run eslint locally
  2. Run eslint against the submodule: js_example
  3. Fix the issues found and make a MR with the fixes.
📌 Task
Status

Closed: outdated

Version

4.0

Component

JavaScript Example

Created by

🇪🇸Spain jlbellido

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024