diff --git a/.eslintrc b/.eslintrc
index 754c8be4f5a..60868ebf751 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,8 +1,12 @@
{
'plugins': [
- 'babel',
+ '@babel',
'promise',
- 'jsdoc',
+ 'jsdoc'
+ ],
+ 'extends': [
+ 'eslint:recommended',
+ 'plugin:promise/recommended'
],
'env': {
'browser': true,
@@ -16,42 +20,19 @@
'M': true,
'Y': true
},
+ // Warn about unused eslint-disable statements.
+ 'reportUnusedDisableDirectives': true,
'rules': {
// See http://eslint.org/docs/rules/ for all rules and explanations of all
// rules.
// === Possible Errors ===
'comma-dangle': 'off',
- 'no-compare-neg-zero': 'error',
- 'no-cond-assign': 'error',
'no-console': 'error',
- 'no-constant-condition': 'error',
- 'no-control-regex': 'error',
- 'no-debugger': 'error',
- 'no-dupe-args': 'error',
- 'no-dupe-keys': 'error',
- 'no-duplicate-case': 'error',
'no-empty': 'warn',
- 'no-empty-character-class': 'error',
- 'no-ex-assign': 'error',
- 'no-extra-boolean-cast': 'error',
'no-extra-parens': 'off',
- 'no-extra-semi': 'error',
- 'no-func-assign': 'error',
- 'no-inner-declarations': 'error',
- 'no-invalid-regexp': 'error',
- 'no-irregular-whitespace': 'error',
- 'no-obj-calls': 'error',
'no-prototype-builtins': 'off',
- 'no-regex-spaces': 'error',
- 'no-sparse-arrays': 'error',
- 'no-unexpected-multiline': 'error',
'no-unreachable': 'warn',
- 'no-unsafe-finally': 'error',
- 'no-unsafe-negation': 'error',
- 'use-isnan': 'error',
- 'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
- 'valid-typeof': 'error',
// === Best Practices ===
// (these mostly match our jshint config)
@@ -63,15 +44,12 @@
'dot-notation': 'warn',
'no-alert': 'warn',
'no-caller': 'error',
- 'no-case-declarations': 'error',
'no-div-regex': 'error',
- 'no-empty-pattern': 'error',
'no-empty-function': 'warn',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
- 'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
'no-global-assign': 'warn',
'no-implied-eval': 'error',
@@ -83,28 +61,22 @@
'no-multi-str': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
- 'no-octal': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-restricted-globals': ['error', { 'name': 'Notification' }],
'no-return-assign': 'error',
'no-script-url': 'error',
- 'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
- 'no-unused-labels': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
- 'no-with': 'error',
'wrap-iife': ['error', 'any'],
// === Variables ===
- 'no-delete-var': 'error',
- 'no-undef': 'error',
'no-undef-init': 'error',
'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
@@ -137,8 +109,6 @@
'max-statements-per-line': ['warn', { max: 2 }],
'new-cap': ['warn', { 'properties': false }],
'new-parens': 'warn',
- 'newline-after-var': 'off',
- 'newline-before-return': 'off',
'newline-per-chained-call': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'error',
@@ -146,7 +116,6 @@
'no-inline-comments': 'off',
'no-lonely-if': 'off',
'no-mixed-operators': 'off',
- 'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': 'warn',
'no-negated-condition': 'off',
'no-nested-ternary': 'warn',
@@ -168,7 +137,6 @@
'padded-blocks': 'off',
'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
'quotes': 'off',
- 'require-jsdoc': 'warn',
'semi': 'error',
'semi-spacing': ['warn', {'before': false, 'after': true}],
'sort-vars': 'off',
@@ -181,21 +149,19 @@
'unicode-bom': 'error',
'wrap-regex': 'off',
- // === Promises ===
+ // === Promises (override plugin:promise/recommended) ===
'promise/always-return': 'warn',
'promise/no-return-wrap': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
'promise/no-native': 'warn',
- 'promise/no-promise-in-callback': 'warn',
- 'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
// === Deprecations ===
"no-restricted-properties": ['warn', {
'object': 'M',
'property': 'str',
- 'message': 'Use AMD module "core/str" or M.util.get_string()'
+ 'message': 'Use "core/str" module or M.util.get_string()'
}],
},
overrides: [
@@ -235,7 +201,6 @@
parser: '@babel/eslint-parser',
// Check AMD with some slightly stricter rules.
rules: {
- 'no-unused-vars': 'error',
'no-implicit-globals': 'error',
// Disable all of the rules that have babel versions.
'new-cap': 'off',
@@ -247,65 +212,37 @@
'semi': 'off',
'no-unused-expressions': 'off',
// Enable all of the babel version of these rules.
- 'babel/new-cap': ['warn', { 'properties': false }],
+ '@babel/new-cap': ['warn', { 'properties': false }],
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
- 'babel/no-invalid-this': 'off',
- 'babel/object-curly-spacing': 'warn',
- // This is off in the original style int.
- 'babel/quotes': 'off',
- 'babel/semi': 'error',
- 'babel/no-unused-expressions': 'error',
+ '@babel/no-invalid-this': 'off',
+ '@babel/object-curly-spacing': 'warn',
+ '@babel/semi': 'error',
+ '@babel/no-unused-expressions': 'error',
// === Promises ===
// We have Promise now that we're using ES6.
'promise/no-native': 'off',
'promise/avoid-new': 'off',
// === JSDocs ===
- "jsdoc/check-access": [
- 'error',
- ],
- "jsdoc/check-alignment": 1, // Recommended.
- "jsdoc/check-param-names": [
- 'error',
- ],
- "jsdoc/check-property-names": [
- 'error',
- ],
- "jsdoc/empty-tags": [
- 'error',
- ],
- "jsdoc/implements-on-classes": [
- 'error',
- ],
- "jsdoc/multiline-blocks": [
- 'error',
- ],
- "jsdoc/require-jsdoc": [
- 'error',
- ],
- "jsdoc/require-param": [
- 'error',
- ],
- "jsdoc/require-param-name": [
- 'error',
- ],
- "jsdoc/require-param-type": [
- 'error',
- ],
- "jsdoc/require-property": [
- 'error',
- ],
- "jsdoc/require-property-name": [
- 'error',
- ],
- "jsdoc/require-property-type": [
- 'error',
- ],
+ 'jsdoc/check-access': 'error',
+ 'jsdoc/check-alignment': 1, // Recommended.
+ 'jsdoc/check-param-names': 'error',
+ 'jsdoc/check-property-names': 'error',
+ 'jsdoc/empty-tags': 'error',
+ 'jsdoc/implements-on-classes': 'error',
+ 'jsdoc/multiline-blocks': 'error',
+ 'jsdoc/require-jsdoc': 'error',
+ 'jsdoc/require-param': 'error',
+ 'jsdoc/require-param-name': 'error',
+ 'jsdoc/require-param-type': 'error',
+ 'jsdoc/require-property': 'error',
+ 'jsdoc/require-property-name': 'error',
+ 'jsdoc/require-property-type': 'error'
},
parserOptions: {
'sourceType': 'module',
- 'requireConfigFile': false,
+ 'requireConfigFile': false
}
}
]
diff --git a/.grunt/tasks/javascript.js b/.grunt/tasks/javascript.js
index 19ece75d5b2..23c9caab581 100644
--- a/.grunt/tasks/javascript.js
+++ b/.grunt/tasks/javascript.js
@@ -21,7 +21,7 @@
*/
/**
- * Function to generate the destination for the uglify task
+ * Function to generate the destination for the minification task
* (e.g. build/file.min.js). This function will be passed to
* the rename property of files array when building dynamically:
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
@@ -60,7 +60,6 @@ module.exports = grunt => {
grunt.registerTask('js', ['amd', 'yui']);
// Register NPM tasks.
- grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rollup');
@@ -104,6 +103,7 @@ module.exports = grunt => {
// The queue runner will run the next `size` items in the queue.
const runQueue = (size = 1) => {
queue.splice(0, size).forEach(resolve => {
+ grunt.log.debug(`Item resolved. Kicking off next one.`);
resolve();
});
};
@@ -113,15 +113,17 @@ module.exports = grunt => {
// The options hook is run in parallel.
// We can return an unresolved Promise which is queued for later resolution.
- options: async() => {
+ options: async(options) => {
return new Promise(resolve => {
queue.push(resolve);
startQueue();
+ return options;
});
},
// When an item in the queue completes, start the next item in the queue.
- buildEnd: () => {
+ generateBundle: (options, bundle) => {
+ grunt.log.debug(`Finished output phase for ${Object.keys(bundle).join(', ')}`);
runQueue();
},
};
@@ -151,24 +153,10 @@ module.exports = grunt => {
//
// It also adds the Moodle plugin name to the AMD module definition
// so that it can be imported as expected in other modules.
- path.resolve('.grunt/babel-plugin-add-module-to-define.js'),
- '@babel/plugin-syntax-dynamic-import',
- '@babel/plugin-syntax-import-meta',
- ['@babel/plugin-proposal-class-properties', {'loose': false}],
- '@babel/plugin-proposal-json-strings'
+ path.resolve('.grunt/babel-plugin-add-module-to-define.js')
],
presets: [
['@babel/preset-env', {
- targets: {
- browsers: [
- ">0.3%",
- "last 2 versions",
- "not ie >= 0",
- "not op_mini all",
- "not Opera > 0",
- "not dead"
- ]
- },
modules: false,
useBuiltIns: false
}]
diff --git a/.grunt/tasks/jsdoc.js b/.grunt/tasks/jsdoc.js
index e2f0680d17b..e4ea713e76c 100644
--- a/.grunt/tasks/jsdoc.js
+++ b/.grunt/tasks/jsdoc.js
@@ -20,17 +20,33 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-module.exports = grunt => {
- // Project configuration.
- grunt.config.merge({
- jsdoc: {
- dist: {
- options: {
- configure: ".grunt/jsdoc/jsdoc.conf.js",
- },
- },
- },
- });
+module.exports = (grunt) => {
+ const path = require('path');
- grunt.loadNpmTasks('grunt-jsdoc');
+ grunt.registerTask('jsdoc', 'Generate JavaScript documentation using jsdoc', function() {
+ const done = this.async();
+ const configuration = path.resolve('.grunt/jsdoc/jsdoc.conf.js');
+
+ grunt.util.spawn({
+ cmd: 'jsdoc',
+ args: [
+ '--configure',
+ configuration,
+ ]
+ }, function(error, result, code) {
+ if (result.stdout) {
+ grunt.log.write(result.stdout);
+ }
+
+ if (result.stderr) {
+ grunt.log.error(result.stderr);
+ }
+ if (error) {
+ grunt.fail.fatal(`JSDoc failed with error code ${code}`);
+ } else {
+ grunt.log.write('JSDoc completed successfully'.green);
+ }
+ done();
+ });
+ });
};
diff --git a/.grunt/tasks/stylelint.js b/.grunt/tasks/stylelint.js
index 0891d423141..864e46151d1 100644
--- a/.grunt/tasks/stylelint.js
+++ b/.grunt/tasks/stylelint.js
@@ -29,6 +29,7 @@ module.exports = grunt => {
// Use a fully-qualified path.
src: files,
options: {
+ quietDeprecationWarnings: true,
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
@@ -45,7 +46,10 @@ module.exports = grunt => {
return {
stylelint: {
scss: {
- options: {syntax: 'scss'},
+ options: {
+ quietDeprecationWarnings: true,
+ customSyntax: 'postcss-scss',
+ },
src: files,
},
},
diff --git a/.nvmrc b/.nvmrc
index 53d838af215..9de2256827a 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-lts/gallium
+lts/iron
diff --git a/.stylelintrc b/.stylelintrc
index ae818b0bf39..c3c4a4ad730 100644
--- a/.stylelintrc
+++ b/.stylelintrc
@@ -1,9 +1,14 @@
{
+ "customSyntax": "postcss-scss",
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
- "csstree/validator": true,
+ "csstree/validator": {
+ "syntaxExtensions": [
+ "sass"
+ ]
+ },
"at-rule-empty-line-before": [ "always",
{"except": [ "blockless-after-blockless"], ignore: ["after-comment", "inside-block"]}
],
@@ -45,7 +50,7 @@
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
- "function-url-scheme-blacklist": ["data"],
+ "function-url-scheme-disallowed-list": ["data"],
"function-whitespace-after": "always",
"indentation": 4,
"keyframe-declaration-no-important": true,
@@ -84,12 +89,19 @@
"selector-type-no-unknown": true,
"string-no-newline": true,
"time-min-milliseconds": 100,
- "unit-blacklist": ["pt"],
+ "unit-disallowed-list": ["pt"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": ["lower", {"ignoreKeywords": ["/(@|$)/"]}],
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
- }
+ },
+ "overrides": [
+ {
+ "files": ["**/yui/**/*.css"],
+ "rules": {
+ }
+ }
+ ]
}
diff --git a/admin/tool/lp/amd/build/competency_rule.min.js.map b/admin/tool/lp/amd/build/competency_rule.min.js.map
index 863fade449a..728f4bc2040 100644
--- a/admin/tool/lp/amd/build/competency_rule.min.js.map
+++ b/admin/tool/lp/amd/build/competency_rule.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"competency_rule.min.js","sources":["../src/competency_rule.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see