Skip to content

Commit

Permalink
MDL-52127 js: switch to a more YUI tolerant eslint config
Browse files Browse the repository at this point in the history
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 Jun 13, 2016
1 parent a158726 commit be4b3cc
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 21 deletions.
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand Down
14 changes: 8 additions & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-ajaxexception', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-alert', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-alert', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-confirm', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-confirm', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-dialogue', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-dialogue', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-exception', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
YUI.add('moodle-core-notification-exception', function (Y, NAME) {

/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down
1 change: 0 additions & 1 deletion lib/yui/src/notification/js/shared.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
var DIALOGUE_PREFIX,
BASE,
CONFIRMYES,
Expand Down

0 comments on commit be4b3cc

Please sign in to comment.