We install node in one of the base images here. The image in the registry contains node v12, but CI is running v16. ESlinting now breaks locally due to a lack of support for optional chaining (?.). Upgrading to this node v16 fixed the issue.
Error output:
docker@payments:/var/www/html/extensions/DonationInterface$ npm run-script test > test > grunt test Running "eslint:all" (eslint) task Warning: Failed to load plugin 'jsdoc' declared in '.eslintrc.json » eslint-config-wikimedia/client-es5 » ./client-common » ./common » ./jsdoc': Unexpected token '?' Referenced from: /var/www/html/extensions/DonationInterface/node_modules/eslint-config-wikimedia/jsdoc.json Use --force to continue. Aborted due to warnings. npm ERR! code 3 npm ERR! path /var/www/html/extensions/DonationInterface npm ERR! command failed npm ERR! command sh -c grunt test npm ERR! A complete log of this run can be found in: npm ERR! /home/docker/.npm/_logs/2023-11-22T11_21_30_034Z-debug.log docker@payments:/var/www/html/extensions/DonationInterface$ node -v v12.22.12
After upgrading:
docker@payments:/var/www/html/extensions/DonationInterface$ npm run-script test > test > grunt test Running "eslint:all" (eslint) task Browserslist: caniuse-lite is outdated. Please run: npx update-browserslist-db@latest Why you should do it regularly: https://github.com/browserslist/update-db#readme /var/www/html/extensions/DonationInterface/adyen_gateway/forms/adyen.js 22:1 warning Missing JSDoc @return type jsdoc/require-returns-type 71:23 warning ES2015 'Promise' class is forbidden es-x/no-promise 153:23 warning ES2015 'Promise' class is forbidden es-x/no-promise 213:34 warning ES2015 'Promise' class is forbidden es-x/no-promise 217:14 warning ES2015 'Promise' class is forbidden es-x/no-promise 227:1 warning Missing JSDoc @param "extraData" type jsdoc/require-param-type 228:1 warning Missing JSDoc @param "billingContact" type jsdoc/require-param-type 229:1 warning Missing JSDoc @param "shippingContact" type jsdoc/require-param-type 332:22 warning ES2015 'Promise' class is forbidden es-x/no-promise 595:4 warning ES2015 'Promise' class is forbidden es-x/no-promise 622:4 warning ES2015 'Promise' class is forbidden es-x/no-promise /var/www/html/extensions/DonationInterface/amazon_gateway/amazon.js 14:23 warning Use a regular expression literal instead of the 'RegExp' constructor prefer-regex-literals 39:14 warning Found non-literal argument to RegExp Constructor security/detect-non-literal-regexp 268:8 warning Selector extensions are not allowed no-jquery/no-sizzle /var/www/html/extensions/DonationInterface/dlocal_gateway/forms/dlocal.js 306:12 warning Found non-literal argument to RegExp Constructor security/detect-non-literal-regexp /var/www/html/extensions/DonationInterface/modules/iframe.liberator.js 1:10 warning 'self' is already defined as a built-in global variable no-redeclare /var/www/html/extensions/DonationInterface/modules/js/ext.donationInterface.errorLog.js 9:26 warning Found non-literal argument to RegExp Constructor security/detect-non-literal-regexp /var/www/html/extensions/DonationInterface/modules/js/ext.donationInterface.forms.js 4:1 warning Missing JSDoc @param "$" type jsdoc/require-param-type 5:1 warning Missing JSDoc @param "mw" type jsdoc/require-param-type 74:25 warning Selector extensions are not allowed no-jquery/no-sizzle 105:1 warning Syntax error in type: function(result) jsdoc/valid-types 249:8 warning Selector extensions are not allowed no-jquery/no-sizzle /var/www/html/extensions/DonationInterface/modules/js/ext.donationInterface.jaVariant01A.js 1:1 warning Missing JSDoc @param "mw" declaration jsdoc/require-param 1:1 warning Missing JSDoc @param "$" declaration jsdoc/require-param /var/www/html/extensions/DonationInterface/modules/js/ext.donationInterface.jaVariant02.js 1:1 warning Missing JSDoc @param "mw" declaration jsdoc/require-param 1:1 warning Missing JSDoc @param "$" declaration jsdoc/require-param /var/www/html/extensions/DonationInterface/modules/js/ext.donationInterface.monthlyConvert.js 26:49 warning 'currency' is already declared in the upper scope on line 3 column 3 no-shadow 34:39 warning 'currency' is already declared in the upper scope on line 3 column 3 no-shadow /var/www/html/extensions/DonationInterface/modules/js/ext.donationInterface.validation.js 7:1 warning Missing JSDoc @param "$" type jsdoc/require-param-type 8:1 warning Missing JSDoc @param "mw" type jsdoc/require-param-type 40:35 warning 'i' is already declared in the upper scope on line 39 column 45 no-shadow /var/www/html/extensions/DonationInterface/modules/validate_input.js 1:1 warning Missing JSDoc @return declaration jsdoc/require-returns 106:27 warning 'value' is already declared in the upper scope on line 83 column 6 no-shadow 108:14 warning All possible message keys should be documented. See https://w.wiki/4r9a for details mediawiki/msg-doc 114:32 warning 'i' is already declared in the upper scope on line 86 column 3 no-shadow 135:24 warning Found non-literal argument to RegExp Constructor security/detect-non-literal-regexp 180:14 warning Found non-literal argument to RegExp Constructor security/detect-non-literal-regexp ✖ 37 problems (0 errors, 37 warnings) 0 errors and 4 warnings potentially fixable with the `--fix` option. Running "stylelint:all" (stylelint) task >> Linted 12 files without errors Running "banana:shared" (banana) task >> 5 message directories checked. Running "banana:email" (banana) task >> 1 message directory checked. Running "banana:gateways" (banana) task >> 4 message directories checked. Done. docker@payments:/var/www/html/extensions/DonationInterface$ node -v v16.20.2