eslint-plugin-mpx 0.2.24 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -242,15 +242,22 @@ module.exports = {
242
242
  CallExpression(node) {
243
243
  if (utils.isScriptSetup(context)) {
244
244
  // setup 直接收集 defineExpose 的值
245
- if (node.callee.name === 'defineExpose') {
245
+ if (
246
+ node.callee.name === 'defineExpose' &&
247
+ node.arguments.length > 0
248
+ ) {
246
249
  commonFunction(node.arguments[0], computedSet)
247
250
  }
248
251
  } else {
249
- if (node.callee.name !== 'createComponent') return
252
+ if (
253
+ node.callee.name !== 'createComponent' ||
254
+ node.arguments.length === 0
255
+ )
256
+ return
250
257
  const properties = node.arguments[0].properties
251
258
  if (!properties) return
252
259
  for (const element of properties) {
253
- if (element.key.name === 'initData') {
260
+ if (element.key && element.key.name === 'initData') {
254
261
  hasInitData = 1
255
262
  }
256
263
  }
@@ -269,17 +276,17 @@ module.exports = {
269
276
  Array.isArray(node.properties)
270
277
  if (isinit) {
271
278
  for (const item of node.properties) {
272
- if (item.key.name === 'initData') {
279
+ if (item.key && item.key.name === 'initData') {
273
280
  handleInitData(item.value.properties, propsSet)
274
281
  }
275
282
  }
276
283
  }
277
284
  },
278
285
  Property(node) {
279
- if (node.key.name === 'computed') {
286
+ if (node.key && node.key.name === 'computed') {
280
287
  commonFunction(node.value, computedSet)
281
288
  }
282
- if (node.key.name === 'initData') {
289
+ if (node.key && node.key.name === 'initData') {
283
290
  const isCreate =
284
291
  node.parent.parent.callee &&
285
292
  node.parent.parent.callee.name === 'createComponent'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-mpx",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "Official ESLint plugin for Mpx.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",