Skip to content

Commit

Permalink
MDL-59761 eslint: support glob-based configuration
Browse files Browse the repository at this point in the history
Since ESlint 4.1.0 [1], it's possible to support glob-based
configuration, this means we can move glob configuration out of grunt
and into the config file, which means tools will respect the glob rules
now too. :)

[1] http://eslint.org/blog/2017/06/eslint-v4.1.0-released
  • Loading branch information
danpoltawski committed Sep 6, 2017
1 parent 9702503 commit 6f60131
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
22 changes: 20 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
'no-global-assign': 'warn',
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
Expand Down Expand Up @@ -192,5 +191,24 @@
'message': 'Use AMD module "core/str" or M.util.get_string()'
}],

}
},
overrides: [
{
files: ["**/yui/src/**/*.js"],
// Disable some rules which we can't safely define for YUI rollups.
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off'
}
},
{
files: ["**/amd/src/*.js"],
// Check AMD with some slightly stricter rules.
rules: {
'no-unused-vars': 'error',
'no-implicit-globals': 'error'
}
}
]
}
21 changes: 2 additions & 19 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,26 +112,9 @@ 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')},
amd: {
src: amdSrc,
// Check AMD with some slightly stricter rules.
rules: {
'no-unused-vars': 'error',
'no-implicit-globals': 'error'
}
},
amd: {src: amdSrc},
// 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'
}
}
}
yui: {src: ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js']}
},
uglify: {
amd: {
Expand Down

0 comments on commit 6f60131

Please sign in to comment.