Permalink
Browse files

MDL-52127 js: check YUI modules with eslint

Because we don't have the entire YUI rollup, we can't apply some of the
rules safely, so we ignore some rules.

At this point I am not 100% certain this configuration is robust enough,
to deal with the lack fo rollup knowledge although its a good sign that
there are no errors on our entire yui codebase.
  • Loading branch information...
danpoltawski committed May 11, 2016
1 parent 3adb62b commit a1587268cba24afce039ab1cd3b482d2d8639805
View
@@ -1,3 +1,6 @@
theme/bootstrapbase/amd/src/bootstrap.js
lib/amd/src/mustache.js
lib/amd/src/loglevel.js
lib/editor/atto/yui/src/rangy/
**/yui/src/*/meta/*.js
lib/yui/src/notification/js/shared.js
View
@@ -77,6 +77,12 @@ module.exports = function(grunt) {
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.
yui: {
src: ['**/yui/src/**/*.js'],
options: {globals: ['Y', 'YUI'], rules: {'no-undef': 'off', 'no-unused-vars': 'off', 'no-empty': 'off'} }
}
},
uglify: {
amd: {
@@ -112,7 +118,7 @@ module.exports = function(grunt) {
},
yui: {
files: ['**/yui/src/**/*.js'],
tasks: ['shifter']
tasks: ['yui']
},
},
shifter: {
@@ -215,7 +221,7 @@ module.exports = function(grunt) {
tasks.startup = function() {
// Are we in a YUI directory?
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
grunt.task.run('shifter');
grunt.task.run('yui');
// Are we in an AMD directory?
} else if (inAMD) {
grunt.task.run('amd');
@@ -252,8 +258,9 @@ module.exports = function(grunt) {
// Register JS tasks.
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
grunt.registerTask('amd', ['eslint:amd', 'jshint', 'uglify']);
grunt.registerTask('js', ['amd', 'shifter']);
grunt.registerTask('js', ['amd', 'yui']);
// Register CSS taks.
grunt.registerTask('css', ['less:bootstrapbase']);
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-alert', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-alert', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-confirm', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-confirm', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-dialogue', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-dialogue', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-exception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,5 +1,6 @@
YUI.add('moodle-core-notification-exception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,3 +1,4 @@
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,

0 comments on commit a158726

Please sign in to comment.