Permalink
Browse files

MDL-52127 js: switch to a more YUI tolerant eslint config

Instead of having the stricter configuration for all files, use
the less strict default config and switch to the stricter config
for building AMD modules.

This means that the eslint commandline/editor inspections will work
better for all files and not generate false positives when using editor
integrations. But since grunt is required to build AMD modules we still
get the stricter checking for those files on build.
  • Loading branch information...
danpoltawski committed May 14, 2016
1 parent a158726 commit be4b3cc6c7cf10645c899e9795f1428d19d19e5e
View
@@ -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',
View
@@ -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: {
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-alert', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-alert', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-confirm', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-confirm', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-dialogue', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-dialogue', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-exception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-exception', function (Y, NAME) {
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
@@ -1,4 +1,3 @@
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,

0 comments on commit be4b3cc

Please sign in to comment.