Changeset 0c6b92a for imaps-frontend/node_modules/eslint-plugin-react/lib/util/isDestructuredFromPragmaImport.js
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/util/isDestructuredFromPragmaImport.js
rd565449 r0c6b92a 1 1 'use strict'; 2 2 3 const astUtil = require('./ast'); 3 4 const pragmaUtil = require('./pragma'); 4 5 const variableUtil = require('./variable'); … … 23 24 if ( 24 25 latestDef.node.init.type === 'MemberExpression' 25 26 26 && latestDef.node.init.object.type === 'Identifier' 27 && latestDef.node.init.object.name === pragma 27 28 ) { 28 29 return true; … … 31 32 if ( 32 33 latestDef.node.init.type === 'Identifier' 33 34 && latestDef.node.init.name === pragma 34 35 ) { 35 36 return true; … … 40 41 41 42 // get "require('react')" from: "{variable} = require('react')" 42 if ( latestDef.node.init.type === 'CallExpression') {43 if (astUtil.isCallExpression(latestDef.node.init)) { 43 44 requireExpression = latestDef.node.init; 44 45 } … … 46 47 if ( 47 48 !requireExpression 48 49 && latestDef.node.init.object.type === 'CallExpression'49 && latestDef.node.init.type === 'MemberExpression' 50 && astUtil.isCallExpression(latestDef.node.init.object) 50 51 ) { 51 52 requireExpression = latestDef.node.init.object; … … 55 56 if ( 56 57 requireExpression 57 58 59 60 58 && requireExpression.callee 59 && requireExpression.callee.name === 'require' 60 && requireExpression.arguments[0] 61 && requireExpression.arguments[0].value === pragma.toLocaleLowerCase() 61 62 ) { 62 63 return true; … … 69 70 if ( 70 71 latestDef.parent 71 72 72 && latestDef.parent.type === 'ImportDeclaration' 73 && latestDef.parent.source.value === pragma.toLocaleLowerCase() 73 74 ) { 74 75 return true;
Note:
See TracChangeset
for help on using the changeset viewer.