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

npm was installing jshint v2.9.1rc1 and reporting lint errors, failing to build

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.9.3, 3.0, 3.1
    • Fix Version/s: 2.9.4, 3.0.1
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide

      Test for all branches:

      1. Run npm install
      2. Run grunt jshint and ensure the build runs succesfully

      Additional tests for master only:

      jshint errors
      You need to install a newer version of jshint than should be installed by the grunt task, so we'll do it manually..

      In your moodle root:

      $ npm install jshint@2.9.1rc1
      $ ./node_modules/jshint/bin/jshint -v
      jshint v2.9.1-rc1
      

      (Verify you've got that version)

      Run jshint on the affected files:

      moodleroot $ ./node_modules/jshint/bin/jshint -c .jshintrc lib/amd/src/templates.js
      moodleroot $ ./node_modules/jshint/bin/jshint -c .jshintrc lib/amd/src/form-autocomplete.js
      

      Optionally run it across the codebase to check for other errors which would be impacted by grunt

      moodleroot $ find . -path "*/amd/src/*" -exec ./node_modules/jshint/bin/jshint -c .jshintrc {} \;
      

      Regression test:

      1. Go to Admin > Development > Template library
      2. Select a template (e.g. core/form_autocomplete_input), ensure the template displays
      3. Add some official tags to the site (In Admin > Appearance > Tags)
      4. Add a new blog entry and play around with adding some tags and ensure it still works
      Show
      Test for all branches: Run npm install Run grunt jshint and ensure the build runs succesfully Additional tests for master only: jshint errors You need to install a newer version of jshint than should be installed by the grunt task, so we'll do it manually.. In your moodle root: $ npm install jshint@2.9.1rc1 $ ./node_modules/jshint/bin/jshint -v jshint v2.9.1-rc1 (Verify you've got that version) Run jshint on the affected files: moodleroot $ ./node_modules/jshint/bin/jshint -c .jshintrc lib/amd/src/templates.js moodleroot $ ./node_modules/jshint/bin/jshint -c .jshintrc lib/amd/src/form-autocomplete.js Optionally run it across the codebase to check for other errors which would be impacted by grunt moodleroot $ find . -path "*/amd/src/*" -exec ./node_modules/jshint/bin/jshint -c .jshintrc {} \; Regression test: Go to Admin > Development > Template library Select a template (e.g. core/form_autocomplete_input), ensure the template displays Add some official tags to the site (In Admin > Appearance > Tags) Add a new blog entry and play around with adding some tags and ensure it still works
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-52204-master

      Description

      After creating the MOODLE_30_STABLE, suddenly grunt build started to fail in the public CI server. And both 29_STABLE and master, some days later, came to the same behavior.

      The key difference is that, in that server, because of the npm version installed, the package 2.9.1rc1 of jshint was being installed, instead of the latest stable 2.8.0, that is normally installed elsewhere.

      Such 2.9.1rc1 was release some days ago (also note that 2.9.0 was revoked because of some serious problems) and it includes some change to the "latedef" checks:

      https://github.com/jshint/jshint/releases

      So, although we are now back to the "correct" 2.8.0 version in the public CI servers and they have started to pass the grunt job... it would be great to know if the problems reported by 2.9.1rc1 are legit or no, because for sure we'll face them once 2.9.1 is released (if they are legit).

      This are the current failures with 2.9.1rc1, FYI:

      >> Shifter build complete.
       
      Running "jshint:files" (jshint) task
       
         lib/amd/src/form-autocomplete.js
          375 |    var updateSelectionList = function(options, state, originalSelect) {
                       ^ 'updateSelectionList' was used before it was defined.
         lib/amd/src/templates.js
          103 |    var partialHelper = function(name) {
                       ^ 'partialHelper' was used before it was defined.
          283 |    var getTemplate = function(templateName, async) {
                       ^ 'getTemplate' was used before it was defined.
       
      >> 3 errors in 19 files
      Warning: Task "jshint:files" failed. Use --force to continue.
      

      Ciao

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    21/Dec/15