Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-76491

ESlint rules are not catching undefined use of Notification module

XMLWordPrintable

      Take for instance the following line: https://github.com/moodle/moodle/blob/15d4ea81e003439c528004a8d555a07cad0f02d3/admin/tool/dataprivacy/amd/src/expand_contract.js#L83

      The Notification module ('core/notification') has not been imported, so the code doesn't work (there are a few similar occurrences)

      The eslint configuration ignores this, because it appears to confuse these undefined references with the browser Notification API

      $ ./node_modules/.bin/grunt amd
      Running "ignorefiles" task
       
      Running "eslint:amd" (eslint) task
      Browserslist: caniuse-lite is outdated. Please run:
        npx browserslist@latest --update-db
        Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
       
      /mnt/export/moodle/master/src/admin/tool/dataprivacy/amd/src/expand_contract.js
        83:22  error  Unexpected use of 'Notification'  no-restricted-globals
       
      /mnt/export/moodle/master/src/calendar/amd/src/event_form.js
        62:24  error  Unexpected use of 'Notification'  no-restricted-globals
       
      /mnt/export/moodle/master/src/lib/amd/src/modal_cancel.js
        34:13  error  Unexpected use of 'Notification'  no-restricted-globals
       
      /mnt/export/moodle/master/src/lib/amd/src/modal_save_cancel.js
        36:13  error  Unexpected use of 'Notification'  no-restricted-globals
        40:13  error  Unexpected use of 'Notification'  no-restricted-globals
        60:9   error  Unexpected use of 'Notification'  no-restricted-globals
       
      ✖ 6 problems (6 errors, 0 warnings)
       
      Warning: Task "eslint:amd" failed. Use --force to continue.
       
      Aborted due to warnings.
      

            pholden Paul Holden
            pholden Paul Holden
            Raquel Ortega Raquel Ortega
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 55 minutes
                1h 55m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.