diff --git a/.eslintrc b/.eslintrc index 05a6283b468..31bd8ab307e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -21,7 +21,7 @@ 'no-dupe-args': 'error', 'no-dupe-keys': 'error', 'no-duplicate-case': 'error', - 'no-empty': 'error', + // Disabled for YUI rollups, enabled by grunt for AMD: 'no-empty': 'error', 'no-empty-character-class': 'error', 'no-ex-assign': 'error', 'no-extra-boolean-cast': 'error', @@ -76,7 +76,7 @@ 'no-self-assign': 'error', 'no-self-compare': 'error', 'no-unmodified-loop-condition': 'error', - 'no-unused-expressions': 'error', + // Disabled for YUI rollups, enabled by grunt for AMD: 'no-unused-expressions': 'error', 'no-unused-labels': 'error', //DEFINE POLICY: 'no-useless-call': 'error', 'no-useless-escape': 'warn', @@ -85,9 +85,9 @@ // === Variables === 'no-delete-var': 'error', - 'no-undef': 'error', + // Disabled for YUI rollups, enabled by grunt for AMD: 'no-undef': 'off', //DEFINE POLICY: 'no-undef-init': 'error', - 'no-unused-vars': 'error', + // Disabled for YUI rollups, enabled by grunt for AMD: 'no-unused-vars': 'error', // === Stylistic Issues === 'array-bracket-spacing': 'warn', diff --git a/Gruntfile.js b/Gruntfile.js index f152d3e1d1f..2ec167eaa64 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -75,13 +75,15 @@ module.exports = function(grunt) { // * It will complain about ignored files (https://github.com/sindresorhus/grunt-eslint/issues/119) // * It's better experience to use editor integrations or eslint natively options: { quiet: !grunt.option('show-lint-warnings') }, - // Check AMD files with standard config - amd: { src: amdSrc }, - // Some rules disabled for YUI config, because we don't do rollup magic, so its able to be accurate - // about undefined items. + // Check AMD files. We add some stricter rules which we can't apply to the default configuration due + // to YUI rollups. + amd: { + src: amdSrc, + options: { rules: {'no-undef': 'error', 'no-unused-vars': 'error', 'no-empty': 'error', 'no-unused-expressions': 'error'} } + }, + // Check YUI module source files. yui: { - src: ['**/yui/src/**/*.js'], - options: {globals: ['Y', 'YUI'], rules: {'no-undef': 'off', 'no-unused-vars': 'off', 'no-empty': 'off'} } + src: ['**/yui/src/**/*.js'] } }, uglify: { diff --git a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js index ecd1ea534c1..bebacc1d174 100644 --- a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js +++ b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js index ecd1ea534c1..bebacc1d174 100644 --- a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js +++ b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js index b0115ec8476..1fa77324b20 100644 --- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js +++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-alert', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js index b0115ec8476..1fa77324b20 100644 --- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js +++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-alert', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js index b98dfe19fa7..459e5951b67 100644 --- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js +++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-confirm', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js index b98dfe19fa7..459e5951b67 100644 --- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js +++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-confirm', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js index f2f2ddd2910..86f372cba1c 100644 --- a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js +++ b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-dialogue', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js index 92c164348d2..26caaf2a363 100644 --- a/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js +++ b/lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-dialogue', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js index 219d336b5e5..6f439323eb1 100644 --- a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js +++ b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-exception', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js index 219d336b5e5..6f439323eb1 100644 --- a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js +++ b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js @@ -1,6 +1,5 @@ YUI.add('moodle-core-notification-exception', function (Y, NAME) { -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES, diff --git a/lib/yui/src/notification/js/shared.js b/lib/yui/src/notification/js/shared.js index b80eb437a46..362bd766c9b 100644 --- a/lib/yui/src/notification/js/shared.js +++ b/lib/yui/src/notification/js/shared.js @@ -1,4 +1,3 @@ -/* eslint-disable */ var DIALOGUE_PREFIX, BASE, CONFIRMYES,