Permalink
Browse files

MDL-54944 eslint: make the .eslintrc default stricter

Instead of using the more rollup-tolerant config for all files, make the
configuration stricter by default but lower in grunt for yui modules.

This means that manual runs (prechecker) or editor integrations will
flag up the errors as well as grunt.

Also add ignore lines to the core files so that eslint isn't noisy when
not running with grunt.
  • Loading branch information...
danpoltawski committed Jun 29, 2016
1 parent 6e30492 commit ad3f8cd18c3c50d73d04e0641b0b8e54386d04c2
Showing with 274 additions and 42 deletions.
  1. +4 −4 .eslintrc
  2. +12 −9 Gruntfile.js
  3. +1 −0 course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js
  4. +1 −0 course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js
  5. +8 −0 course/yui/build/moodle-course-management/moodle-course-management-debug.js
  6. +8 −0 course/yui/build/moodle-course-management/moodle-course-management.js
  7. +4 −0 course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-debug.js
  8. +4 −0 course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes.js
  9. +1 −0 course/yui/src/dragdrop/js/dragdrop.js
  10. +2 −0 course/yui/src/management/js/category.js
  11. +2 −0 course/yui/src/management/js/console.js
  12. +2 −0 course/yui/src/management/js/course.js
  13. +2 −0 course/yui/src/management/js/dd.js
  14. +2 −0 course/yui/src/toolboxes/js/resource.js
  15. +2 −0 course/yui/src/toolboxes/js/section.js
  16. +1 −1 course/yui/src/toolboxes/js/toolbox.js
  17. +2 −0 ...ld/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-debug.js
  18. +2 −0 ...ui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable.js
  19. +1 −0 grade/report/grader/yui/src/gradereporttable/js/floatingheaders.js
  20. +1 −0 grade/report/grader/yui/src/gradereporttable/js/gradereporttable.js
  21. +7 −0 lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
  22. +7 −0 lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js
  23. +1 −0 lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js
  24. +1 −0 lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js
  25. +2 −0 lib/editor/atto/yui/src/editor/js/autosave.js
  26. +1 −0 lib/editor/atto/yui/src/editor/js/clean.js
  27. +1 −0 lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js
  28. +1 −0 lib/editor/atto/yui/src/editor/js/editor.js
  29. +0 −1 lib/editor/atto/yui/src/editor/js/lintconfig.js
  30. +1 −0 lib/editor/atto/yui/src/editor/js/selection.js
  31. +1 −0 lib/editor/atto/yui/src/editor/js/styling.js
  32. +1 −0 lib/editor/atto/yui/src/editor/js/toolbar-keyboardnav.js
  33. +2 −0 lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-debug.js
  34. +2 −0 lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector.js
  35. +2 −0 lib/form/yui/src/dateselector/js/dateselector.js
  36. +6 −0 lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js
  37. +6 −0 lib/yui/build/moodle-core-blocks/moodle-core-blocks.js
  38. +9 −2 lib/yui/build/moodle-core-dock/moodle-core-dock-debug.js
  39. +9 −2 lib/yui/build/moodle-core-dock/moodle-core-dock.js
  40. +2 −0 lib/yui/build/moodle-core-languninstallconfirm/moodle-core-languninstallconfirm-debug.js
  41. +2 −0 lib/yui/build/moodle-core-languninstallconfirm/moodle-core-languninstallconfirm.js
  42. +3 −0 lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js
  43. +3 −0 lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js
  44. +3 −0 lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js
  45. +3 −0 lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js
  46. +3 −0 lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js
  47. +3 −0 lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js
  48. +5 −0 lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue-debug.js
  49. +5 −0 lib/yui/build/moodle-core-notification-dialogue/moodle-core-notification-dialogue.js
  50. +3 −0 lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js
  51. +3 −0 lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js
  52. +2 −0 lib/yui/src/blocks/js/blockregion.js
  53. +2 −0 lib/yui/src/blocks/js/blocks.js
  54. +2 −0 lib/yui/src/blocks/js/manager.js
  55. +2 −0 lib/yui/src/dock/js/block.js
  56. +1 −2 lib/yui/src/dock/js/dock.js
  57. +2 −0 lib/yui/src/dock/js/dockeditem.js
  58. +2 −0 lib/yui/src/dock/js/panel.js
  59. +2 −0 lib/yui/src/dock/js/tabheightmanager.js
  60. +2 −0 lib/yui/src/languninstallconfirm/js/languninstallconfirm.js
  61. +2 −0 lib/yui/src/notification/js/ajaxexception.js
  62. +2 −0 lib/yui/src/notification/js/alert.js
  63. +2 −0 lib/yui/src/notification/js/confirm.js
  64. +2 −0 lib/yui/src/notification/js/dialogue.js
  65. +2 −0 lib/yui/src/notification/js/exception.js
  66. +2 −0 lib/yui/src/notification/js/info.js
  67. +1 −0 lib/yui/src/notification/js/shared.js
  68. +3 −0 message/yui/build/moodle-core_message-messenger/moodle-core_message-messenger-debug.js
  69. +3 −0 message/yui/build/moodle-core_message-messenger/moodle-core_message-messenger.js
  70. +1 −0 message/yui/src/messenger/js/constants.js
  71. +1 −0 message/yui/src/messenger/js/manager.js
  72. +1 −0 message/yui/src/messenger/js/sendmessage.js
  73. +15 −0 ...tpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js
  74. +15 −0 ...ck/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor.js
  75. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotation.js
  76. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotationhighlight.js
  77. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotationline.js
  78. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotationoval.js
  79. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotationpen.js
  80. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotationrectangle.js
  81. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/annotationstamp.js
  82. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/comment.js
  83. +2 −0 mod/assign/feedback/editpdf/yui/src/editor/js/commentsearch.js
  84. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/drawable.js
  85. +2 −0 mod/assign/feedback/editpdf/yui/src/editor/js/editor.js
  86. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/globals.js
  87. +1 −0 mod/assign/feedback/editpdf/yui/src/editor/js/quickcommentlist.js
  88. +2 −0 mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop-debug.js
  89. +2 −0 mod/quiz/yui/build/moodle-mod_quiz-dragdrop/moodle-mod_quiz-dragdrop.js
  90. +5 −6 mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-debug.js
  91. +3 −3 mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes-min.js
  92. +5 −6 mod/quiz/yui/build/moodle-mod_quiz-toolboxes/moodle-mod_quiz-toolboxes.js
  93. +2 −0 mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page-debug.js
  94. +2 −0 mod/quiz/yui/build/moodle-mod_quiz-util-page/moodle-mod_quiz-util-page.js
  95. +1 −0 mod/quiz/yui/src/dragdrop/js/dragdrop.js
  96. +1 −0 mod/quiz/yui/src/dragdrop/js/resource.js
  97. +2 −6 mod/quiz/yui/src/toolboxes/js/resource.js
  98. +2 −0 mod/quiz/yui/src/toolboxes/js/section.js
  99. +1 −0 mod/quiz/yui/src/toolboxes/js/toolbox.js
  100. +2 −0 mod/quiz/yui/src/util/js/page.js
View
@@ -63,7 +63,7 @@
'no-extra-bind': 'warn',
'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
// Disabled for YUI rollups, enabled by grunt for AMD: 'no-implicit-globals': 'warn',
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
@@ -85,7 +85,7 @@
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
// Disabled for YUI rollups, enabled by grunt for AMD: 'no-unused-expressions': 'error',
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
@@ -94,9 +94,9 @@
// === Variables ===
'no-delete-var': 'error',
// Disabled for YUI rollups, enabled by grunt for AMD: 'no-undef': 'off',
'no-undef': 'error',
'no-undef-init': 'error',
// Disabled for YUI rollups, enabled by grunt for AMD: 'no-unused-vars': 'error',
'no-unused-vars': ['error', { 'caughtErrors': 'none', 'argsIgnorePattern': "(e|event)" }],
// === Stylistic Issues ===
'array-bracket-spacing': 'warn',
View
@@ -105,22 +105,25 @@ module.exports = function(grunt) {
// Even though warnings dont stop the build we don't display warnings by default because
// at this moment we've got too many core warnings.
options: {quiet: !grunt.option('show-lint-warnings')},
// 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-unused-expressions': 'error',
'no-implicit-globals': 'error'
}
// Check AMD with some slightly stricter rules.
rules: {
'no-unused-vars': 'error',
'no-implicit-globals': 'error'
}
},
// Check YUI module source files.
yui: {
src: ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js'],
options: {
// Disable some rules which we can't safely define for YUI rollups.
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off'
}
}
}
},
uglify: {
@@ -1,5 +1,6 @@
YUI.add('moodle-course-dragdrop', function (Y, NAME) {
/* eslint-disable no-unused-vars */
/**
* Drag and Drop for course sections and course modules.
*
@@ -1,5 +1,6 @@
YUI.add('moodle-course-dragdrop', function (Y, NAME) {
/* eslint-disable no-unused-vars */
/**
* Drag and Drop for course sections and course modules.
*
@@ -1,5 +1,7 @@
YUI.add('moodle-course-management', function (Y, NAME) {
/* global DragDrop, Category, Course */
/**
* Provides drop down menus for list of action links.
*
@@ -588,6 +590,8 @@ M.course.management.console = null;
M.course.management.init = function(config) {
M.course.management.console = new Console(config);
};
/* global Console */
/**
* Drag and Drop handler
*
@@ -1173,6 +1177,8 @@ Item.prototype = {
}
};
Y.extend(Item, Y.Base, Item.prototype);
/* global Item */
/**
* A managed category.
*
@@ -1616,6 +1622,8 @@ Category.prototype = {
}
};
Y.extend(Category, Item, Category.prototype);
/* global Item */
/**
* A managed course.
*
@@ -1,5 +1,7 @@
YUI.add('moodle-course-management', function (Y, NAME) {
/* global DragDrop, Category, Course */
/**
* Provides drop down menus for list of action links.
*
@@ -581,6 +583,8 @@ M.course.management.console = null;
M.course.management.init = function(config) {
M.course.management.console = new Console(config);
};
/* global Console */
/**
* Drag and Drop handler
*
@@ -1147,6 +1151,8 @@ Item.prototype = {
}
};
Y.extend(Item, Y.Base, Item.prototype);
/* global Item */
/**
* A managed category.
*
@@ -1575,6 +1581,8 @@ Category.prototype = {
}
};
Y.extend(Category, Item, Category.prototype);
/* global Item */
/**
* A managed course.
*
@@ -1,5 +1,6 @@
YUI.add('moodle-course-toolboxes', function (Y, NAME) {
/* eslint-disable no-unused-vars */
/**
* Resource and activity toolbox class.
*
@@ -198,6 +199,7 @@ Y.extend(TOOLBOX, Y.Base, {
}
}
);
/* global TOOLBOX, BODY, SELECTOR, INDENTLIMITS */
/**
* Resource and activity toolbox class.
@@ -749,6 +751,8 @@ M.course.init_resource_toolbox = function(config) {
M.course.resource_toolbox = new RESOURCETOOLBOX(config);
return M.course.resource_toolbox;
};
/* global SELECTOR, TOOLBOX */
/**
* Resource and activity toolbox class.
*
@@ -1,5 +1,6 @@
YUI.add('moodle-course-toolboxes', function (Y, NAME) {
/* eslint-disable no-unused-vars */
/**
* Resource and activity toolbox class.
*
@@ -198,6 +199,7 @@ Y.extend(TOOLBOX, Y.Base, {
}
}
);
/* global TOOLBOX, BODY, SELECTOR, INDENTLIMITS */
/**
* Resource and activity toolbox class.
@@ -749,6 +751,8 @@ M.course.init_resource_toolbox = function(config) {
M.course.resource_toolbox = new RESOURCETOOLBOX(config);
return M.course.resource_toolbox;
};
/* global SELECTOR, TOOLBOX */
/**
* Resource and activity toolbox class.
*
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/**
* Drag and Drop for course sections and course modules.
*
@@ -1,3 +1,5 @@
/* global Item */
/**
* A managed category.
*
@@ -1,3 +1,5 @@
/* global DragDrop, Category, Course */
/**
* Provides drop down menus for list of action links.
*
@@ -1,3 +1,5 @@
/* global Item */
/**
* A managed course.
*
@@ -1,3 +1,5 @@
/* global Console */
/**
* Drag and Drop handler
*
@@ -1,3 +1,5 @@
/* global TOOLBOX, BODY, SELECTOR, INDENTLIMITS */
/**
* Resource and activity toolbox class.
*
@@ -1,3 +1,5 @@
/* global SELECTOR, TOOLBOX */
/**
* Resource and activity toolbox class.
*
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/**
* Resource and activity toolbox class.
*
@@ -196,4 +197,3 @@ Y.extend(TOOLBOX, Y.Base, {
}
}
);
@@ -14,6 +14,7 @@ YUI.add('moodle-gradereport_grader-gradereporttable', function (Y, NAME) {
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable no-unused-vars */
/**
* Grader Report Functionality.
@@ -155,6 +156,7 @@ Y.namespace('M.gradereport_grader').init = function(config) {
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global SELECTORS */
/**
* @module moodle-gradereport_grader-gradereporttable
@@ -14,6 +14,7 @@ YUI.add('moodle-gradereport_grader-gradereporttable', function (Y, NAME) {
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable no-unused-vars */
/**
* Grader Report Functionality.
@@ -155,6 +156,7 @@ Y.namespace('M.gradereport_grader').init = function(config) {
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global SELECTORS */
/**
* @module moodle-gradereport_grader-gradereporttable
@@ -12,6 +12,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global SELECTORS */
/**
* @module moodle-gradereport_grader-gradereporttable
@@ -12,6 +12,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable no-unused-vars */
/**
* Grader Report Functionality.
@@ -14,6 +14,7 @@ YUI.add('moodle-editor_atto-editor', function (Y, NAME) {
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable no-unused-vars */
/**
* The Atto WYSIWG pluggable editor, written for Moodle.
@@ -735,6 +736,8 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorTextArea]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global NOTIFY_WARNING, NOTIFY_INFO */
/* eslint-disable no-unused-vars */
/**
* A autosave function for the Atto editor.
@@ -1250,6 +1253,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorAutosaveIo]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global LOGNAME */
/**
* @module moodle-editor_atto-editor
@@ -1875,6 +1879,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorToolbar]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global LOGNAME */
/**
* @module moodle-editor_atto-editor
@@ -2083,6 +2088,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorToolbarNav]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global rangy */
/**
* @module moodle-editor_atto-editor
@@ -2503,6 +2509,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorSelection]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global rangy */
/**
* @module moodle-editor_atto-editor
@@ -14,6 +14,7 @@ YUI.add('moodle-editor_atto-editor', function (Y, NAME) {
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* eslint-disable no-unused-vars */
/**
* The Atto WYSIWG pluggable editor, written for Moodle.
@@ -730,6 +731,8 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorTextArea]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global NOTIFY_WARNING, NOTIFY_INFO */
/* eslint-disable no-unused-vars */
/**
* A autosave function for the Atto editor.
@@ -1239,6 +1242,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorAutosaveIo]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global LOGNAME */
/**
* @module moodle-editor_atto-editor
@@ -1863,6 +1867,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorToolbar]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global LOGNAME */
/**
* @module moodle-editor_atto-editor
@@ -2069,6 +2074,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorToolbarNav]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global rangy */
/**
* @module moodle-editor_atto-editor
@@ -2489,6 +2495,7 @@ Y.Base.mix(Y.M.editor_atto.Editor, [EditorSelection]);
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* global rangy */
/**
* @module moodle-editor_atto-editor
Oops, something went wrong.

0 comments on commit ad3f8cd

Please sign in to comment.