* @param {*} node * @return {Object}
(node)
| 15 | * @return {Object} |
| 16 | */ |
| 17 | function verifyPath(node) { |
| 18 | for (let n = node; n; n = n.parent) { |
| 19 | const {parent} = n; |
| 20 | const {type} = parent; |
| 21 | |
| 22 | if (type === 'ArrayExpression' || type === 'ObjectExpression') { |
| 23 | continue; |
| 24 | } |
| 25 | |
| 26 | if (type === 'Property' && parent.value === n) { |
| 27 | continue; |
| 28 | } |
| 29 | |
| 30 | if (type === 'CallExpression') { |
| 31 | const {name} = parent.callee; |
| 32 | if (name === 'jsonConfiguration' || name === 'jsonLiteral') { |
| 33 | break; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | return context.report({ |
| 38 | node, |
| 39 | message: 'Value must descend from object/array literals only.', |
| 40 | }); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | return { |
| 45 | 'CallExpression[callee.name=jsonConfiguration]': function (node) { |
no test coverage detected