diff --git a/.eslintrc.js b/.eslintrc.js index c6ff795d21..6fd75af112 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,9 +14,12 @@ module.exports = { 'swan': false, 'Component': false, 'Page': false, - 'App': false + 'App': false, + '__mpx_mode__': false, + 'getRegExp': false }, rules: { - 'no-cond-assign': 0 + 'no-cond-assign': 0, + "camelcase": ['error', {'allow': ['__mpx_mode__', '__swan_exports_map__']}] } } diff --git a/packages/webpack-plugin/lib/runtime/injectHelper.wxs b/packages/webpack-plugin/lib/runtime/injectHelper.wxs index e37b3b8a06..464ba890ed 100644 --- a/packages/webpack-plugin/lib/runtime/injectHelper.wxs +++ b/packages/webpack-plugin/lib/runtime/injectHelper.wxs @@ -77,13 +77,12 @@ function concat (a, b) { return a ? b ? (a + ' ' + b) : a : (b || '') } - function isObject (obj) { return obj !== null && typeof obj === 'object' } function likeArray (arr) { - return arr.constructor === 'Array' + return arr && arr.constructor === 'Array' } function isDef (v) { @@ -91,7 +90,7 @@ function isDef (v) { } function stringifyClass (value) { - if (value === undefined) return '' + if (!value) return '' if (likeArray(value)) { return stringifyArray(value) } @@ -179,7 +178,7 @@ function mergeObjectArray (arr) { } function normalizeDynamicStyle (value) { - if (value === undefined) return {} + if (!value) return {} if (likeArray(value)) { return mergeObjectArray(value) }