eslint-plugin-mpx 0.2.25 → 0.2.27

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.
@@ -11,6 +11,7 @@
11
11
  const utils = require('../utils')
12
12
  function commonFunction(value, list) {
13
13
  const props = value.properties
14
+ if (!props) return false
14
15
  for (const item of props) {
15
16
  if (
16
17
  item.type === 'SpreadElement' &&
@@ -257,7 +258,7 @@ module.exports = {
257
258
  const properties = node.arguments[0].properties
258
259
  if (!properties) return
259
260
  for (const element of properties) {
260
- if (element.key.name === 'initData') {
261
+ if (element.key && element.key.name === 'initData') {
261
262
  hasInitData = 1
262
263
  }
263
264
  }
@@ -276,17 +277,17 @@ module.exports = {
276
277
  Array.isArray(node.properties)
277
278
  if (isinit) {
278
279
  for (const item of node.properties) {
279
- if (item.key.name === 'initData') {
280
+ if (item.key && item.key.name === 'initData') {
280
281
  handleInitData(item.value.properties, propsSet)
281
282
  }
282
283
  }
283
284
  }
284
285
  },
285
286
  Property(node) {
286
- if (node.key.name === 'computed') {
287
+ if (node.key && node.key.name === 'computed') {
287
288
  commonFunction(node.value, computedSet)
288
289
  }
289
- if (node.key.name === 'initData') {
290
+ if (node.key && node.key.name === 'initData') {
290
291
  const isCreate =
291
292
  node.parent.parent.callee &&
292
293
  node.parent.parent.callee.name === 'createComponent'
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "eslint-plugin-mpx",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "description": "Official ESLint plugin for Mpx.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "scripts": {
8
8
  "start": "npm run test:base -- --watch --growl",
9
9
  "test": "mocha \"tests/lib/**/*.js\" --reporter dot",
10
- "test:only": "mocha \"tests/lib/rules/valid-setup-define-expose.js\" --reporter dot",
10
+ "test:only": "mocha \"tests/lib/rules/valid-initdata.js\" --reporter dot",
11
11
  "debug": "mocha --inspect \"tests/lib/**/*.js\" --reporter dot --timeout 60000",
12
12
  "cover": "npm run cover:test && npm run cover:report",
13
13
  "cover:test": "nyc npm run test -- --timeout 60000",