mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 23:59:41 +02:00
MDL-59761 eslint: support glob-based configuration
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
This commit is contained in:
parent
9702503f6b
commit
6f601313f0
2 changed files with 22 additions and 21 deletions
22
.eslintrc
22
.eslintrc
|
@ -68,7 +68,6 @@
|
||||||
'no-fallthrough': 'error',
|
'no-fallthrough': 'error',
|
||||||
'no-floating-decimal': 'warn',
|
'no-floating-decimal': 'warn',
|
||||||
'no-global-assign': 'warn',
|
'no-global-assign': 'warn',
|
||||||
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
|
|
||||||
'no-implied-eval': 'error',
|
'no-implied-eval': 'error',
|
||||||
'no-invalid-this': 'error',
|
'no-invalid-this': 'error',
|
||||||
'no-iterator': 'error',
|
'no-iterator': 'error',
|
||||||
|
@ -192,5 +191,24 @@
|
||||||
'message': 'Use AMD module "core/str" or M.util.get_string()'
|
'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
Gruntfile.js
21
Gruntfile.js
|
@ -112,26 +112,9 @@ module.exports = function(grunt) {
|
||||||
// Even though warnings dont stop the build we don't display warnings by default because
|
// 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.
|
// at this moment we've got too many core warnings.
|
||||||
options: {quiet: !grunt.option('show-lint-warnings')},
|
options: {quiet: !grunt.option('show-lint-warnings')},
|
||||||
amd: {
|
amd: {src: amdSrc},
|
||||||
src: amdSrc,
|
|
||||||
// Check AMD with some slightly stricter rules.
|
|
||||||
rules: {
|
|
||||||
'no-unused-vars': 'error',
|
|
||||||
'no-implicit-globals': 'error'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Check YUI module source files.
|
// Check YUI module source files.
|
||||||
yui: {
|
yui: {src: ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js']}
|
||||||
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: {
|
uglify: {
|
||||||
amd: {
|
amd: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue