Lab-Lab-Lab / CPR-Music

0 stars 9 forks source link

Help fix frontend to satisfy eslint #21

Open hcientist opened 2 months ago

hcientist commented 2 months ago

pull the changes from https://github.com/Lab-Lab-Lab/CPR-Music-hcientist/tree/standardize_format and then run npx eslint . while inside of the frontend root directory (the one that has .eslintrc.json and pages/ and whatnot) the remaining issues all seem helpful (rather than random nitpicks) currently the eslint output is as follows (59 issues):

> npx eslint .

CPR-Music-hcientist/components/recorder.js
   47:16  error  'toggleVolume' was used before it was defined        no-use-before-define
   53:16  error  'toggleVolume' was used before it was defined        no-use-before-define
   59:16  error  'toggleVolume' was used before it was defined        no-use-before-define
   70:16  error  'toggleVolume' was used before it was defined        no-use-before-define
   99:50  error  'handleVolumeChange' was used before it was defined  no-use-before-define
  184:11  error  JSX props should not use functions                   react/jsx-no-bind

CPR-Music-hcientist/components/student/create/explore.js
  143:13  error  JSX props should not use functions  react/jsx-no-bind
  167:13  error  JSX props should not use functions  react/jsx-no-bind
  191:13  error  JSX props should not use functions  react/jsx-no-bind
  198:33  error  JSX props should not use functions  react/jsx-no-bind
  217:17  error  JSX props should not use functions  react/jsx-no-bind
  229:17  error  JSX props should not use functions  react/jsx-no-bind
  241:17  error  JSX props should not use functions  react/jsx-no-bind

CPR-Music-hcientist/components/student/create/theoretical.js
  105:28  error  'currentAssignment' was used before it was defined  no-use-before-define
  196:27  error  Do not use Array index in keys                      react/no-array-index-key
  217:19  error  JSX props should not use functions                  react/jsx-no-bind

CPR-Music-hcientist/components/student/instructions.js
  8:36  warning  Dangerous property 'dangerouslySetInnerHTML' found  react/no-danger

CPR-Music-hcientist/components/student/piecePicker.js
  57:22  error  JSX props should not use functions  react/jsx-no-bind

CPR-Music-hcientist/components/student/recentSubmission.js
  13:13  error  Identifier 'activity_type_category' is not in camel case  camelcase
  20:16  error  Identifier 'activity_type_category' is not in camel case  camelcase
  46:12  error  Do not nest ternary expressions                           no-nested-ternary

CPR-Music-hcientist/components/teacher/grade/perform.js
  70:26  error  Do not nest ternary expressions  no-nested-ternary

CPR-Music-hcientist/lib/flat.js
   50:7   error  Assignment to property of function parameter 'measure'       no-param-reassign
   56:11  error  Assignment to property of function parameter 'directionObj'  no-param-reassign
   59:11  error  Assignment to property of function parameter 'directionObj'  no-param-reassign
   64:5   error  Assignment to property of function parameter 'measure'       no-param-reassign
   92:25  error  'nthSliceIdxs' was used before it was defined                no-use-before-define
  375:37  error  Unary operator '++' used                                     no-plusplus
  376:5   error  Assignment to property of function parameter 'notes'         no-param-reassign
  393:40  error  Unary operator '++' used                                     no-plusplus

CPR-Music-hcientist/lib/variations.js
   14:44  error    'template' was used before it was defined                                                                                                                                  no-use-before-define
   22:41  error    'key' is already declared in the upper scope on line 12 column 29                                                                                                          no-shadow
   23:50  error    Expected '!==' and instead saw '!='                                                                                                                                        eqeqeq
   50:65  error    Unary operator '--' used                                                                                                                                                   no-plusplus
   50:70  error    Unary operator '--' used                                                                                                                                                   no-plusplus
   52:45  error    Expected '===' and instead saw '=='                                                                                                                                        eqeqeq
   85:21  error    Expected '!==' and instead saw '!='                                                                                                                                        eqeqeq
   90:3   error    Expected an assignment or function call and instead saw an expression                                                                                                      no-unused-expressions
   92:7   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
   95:7   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  102:5   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  132:7   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  133:18  error    Missing radix parameter                                                                                                                                                    radix
  160:75  error    Expected '===' and instead saw '=='                                                                                                                                        eqeqeq
  168:5   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  169:5   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  170:22  error    Unexpected chained assignment                                                                                                                                              no-multi-assign
  170:22  error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  174:5   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  184:3   error    iterators/generators require regenerator-runtime, which is too
                    heavyweight for this guide to allow them. Separately, loops
                    should be avoided in favor of array iterations  no-restricted-syntax
  219:3   error    iterators/generators require regenerator-runtime, which is too
                    heavyweight for this guide to allow them. Separately, loops
                    should be avoided in favor of array iterations  no-restricted-syntax
  227:3   error    iterators/generators require regenerator-runtime, which is too
                    heavyweight for this guide to allow them. Separately, loops
                    should be avoided in favor of array iterations  no-restricted-syntax
  229:26  error    Do not access Object.prototype method 'hasOwnProperty' from target object                                                                                                  no-prototype-builtins
  234:17  error    Expected '===' and instead saw '=='                                                                                                                                        eqeqeq
  269:1   error    Array prototype is read only, properties should not be added                                                                                                               no-extend-native
  269:26  warning  Unexpected unnamed function                                                                                                                                                func-names
  292:7   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  293:7   error    Assignment to property of function parameter 'note'                                                                                                                        no-param-reassign
  296:5   error    Assignment to property of function parameter 'measure'                                                                                                                     no-param-reassign

✖ 59 problems (57 errors, 2 warnings)
hcientist commented 2 months ago

Proposed process:

  1. clone my fork (or fork my fork? and clone that)
  2. checkout the standardize_format branch
  3. run npx eslint . and confirm you get the output like i have above (pretty much exactly)
  4. start trying to fix the listed issues

I changed my mind about the below, do the above first

    1. sync your fork with the upstream
    2. go to your repo on github.com (e.g. mine is https://github.com/Lab-Lab-Lab/CPR-Music-hcientist )
    3. somewhere in the top middle there should be a sync fork button
  1. checkout main (locally) and pull
  2. create a branch for helping with this
    1. git checkout -b help_w_format
  3. pull the changes linked in the description:
    1. add a remote to your local git repo call it stewart with the link https://github.com/Lab-Lab-Lab/CPR-Music-hcientist.git
      1. git remote add stewart https://github.com/Lab-Lab-Lab/CPR-Music-hcientist.git
    2. git pull stewart standardize_format
  4. run npx eslint . and confirm you get the output like i have above (pretty much exactly)
  5. start trying to fix the listed issues