Changeset 0c6b92a for imaps-frontend/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js
rd565449 r0c6b92a 10 10 const report = require('../util/report'); 11 11 12 const optionDefaults = { component: true, html: true }; 13 14 function isComponent(node) { 15 return ( 16 node.name 17 && (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression') 18 && !jsxUtil.isDOMComponent(node) 19 ); 20 } 21 22 function childrenIsEmpty(node) { 23 return node.parent.children.length === 0; 24 } 25 26 function childrenIsMultilineSpaces(node) { 27 const childrens = node.parent.children; 28 29 return ( 30 childrens.length === 1 31 && (childrens[0].type === 'Literal' || childrens[0].type === 'JSXText') 32 && childrens[0].value.indexOf('\n') !== -1 33 && childrens[0].value.replace(/(?!\xA0)\s/g, '') === '' 34 ); 35 } 36 12 37 // ------------------------------------------------------------------------------ 13 38 // Rule Definition 14 39 // ------------------------------------------------------------------------------ 15 16 const optionDefaults = { component: true, html: true };17 40 18 41 const messages = { … … 50 73 51 74 create(context) { 52 function isComponent(node) {53 return (54 node.name55 && (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression')56 && !jsxUtil.isDOMComponent(node)57 );58 }59 60 function childrenIsEmpty(node) {61 return node.parent.children.length === 0;62 }63 64 function childrenIsMultilineSpaces(node) {65 const childrens = node.parent.children;66 67 return (68 childrens.length === 169 && (childrens[0].type === 'Literal' || childrens[0].type === 'JSXText')70 && childrens[0].value.indexOf('\n') !== -171 && childrens[0].value.replace(/(?!\xA0)\s/g, '') === ''72 );73 }74 75 75 function isShouldBeSelfClosed(node) { 76 76 const configuration = Object.assign({}, optionDefaults, context.options[0]);
Note:
See TracChangeset
for help on using the changeset viewer.