Run eslint on compiled assets to ensure code is es5 compatible

It doesn't feel great but it does the trick.

Bug: T174570
Change-Id: I76d1b81625a77df0d926c2da714bcab606a28b8d
This commit is contained in:
jdlrobson 2017-09-05 16:31:21 -04:00 committed by joakin
parent eb6c893e1e
commit 90fbd093c8
2 changed files with 68 additions and 10 deletions

49
.eslintrc.es5.json Normal file
View file

@ -0,0 +1,49 @@
{
"parserOptions": {
"sourceType": "script",
"ecmaVersion": "5"
},
"env": {
"browser": true,
"jquery": true,
"commonjs": false,
"qunit": true
},
"rules": {
"spaced-comment": 0,
"space-in-parens": 0,
"block-spacing": 0,
"object-curly-spacing": 0,
"eol-last": 0,
"semi": 0,
"comma-spacing": 0,
"space-before-function-paren": 0,
"space-before-blocks": 0,
"space-infix-ops": 0,
"vars-on-top": 0,
"semi-spacing": 0,
"key-spacing": 0,
"quotes": 0,
"no-return-assign": 0,
"keyword-spacing": 0,
"eqeqeq": 0,
"yoda": 0,
"computed-property-spacing": 0,
"no-unused-expressions": 0,
"no-sequences": 0,
"array-bracket-spacing": 0,
"no-void": 0,
"no-unused-vars": 0,
"no-undef": 0,
"quote-props": 0,
"curly": 0,
"one-var": 0,
"no-console": 0,
"no-underscore-dangle": 0,
"wrap-iife": 0,
"new-parens": 0,
"no-fallthrough": 0,
"no-implicit-coercion": 0,
"no-catch-shadow": 0
}
}

View file

@ -12,15 +12,24 @@ module.exports = function ( grunt ) {
grunt.initConfig( {
banana: conf.MessagesDirs,
eslint: {
all: [
'src/**',
'resources/ext.popups/*.js',
'resources/ext.popups/**/*.js',
'tests/node-qunit/**/*.js',
'!resources/dist/index.js',
'!docs/**',
'!node_modules/**'
]
// Lint the built artifacts with ES5 so that no ES6 slips to production
build: {
options: {
configFile: '.eslintrc.es5.json'
},
src: [
'resources/dist/*.js'
]
},
sources: {
src: [
'src/**',
'tests/node-qunit/**/*.js',
'!resources/dist/index.js',
'!docs/**',
'!node_modules/**'
]
}
},
jsonlint: {
all: [
@ -56,6 +65,6 @@ module.exports = function ( grunt ) {
}
} );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'lint', [ 'eslint', 'stylelint', 'jsonlint', 'banana', 'eslint:build' ] );
grunt.registerTask( 'default', [ 'lint' ] );
};