Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/eslint-plugin-react/lib/rules/self-closing-comp.js

    rd565449 r0c6b92a  
    1010const report = require('../util/report');
    1111
     12const optionDefaults = { component: true, html: true };
     13
     14function isComponent(node) {
     15  return (
     16    node.name
     17    && (node.name.type === 'JSXIdentifier' || node.name.type === 'JSXMemberExpression')
     18    && !jsxUtil.isDOMComponent(node)
     19  );
     20}
     21
     22function childrenIsEmpty(node) {
     23  return node.parent.children.length === 0;
     24}
     25
     26function 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
    1237// ------------------------------------------------------------------------------
    1338// Rule Definition
    1439// ------------------------------------------------------------------------------
    15 
    16 const optionDefaults = { component: true, html: true };
    1740
    1841const messages = {
     
    5073
    5174  create(context) {
    52     function isComponent(node) {
    53       return (
    54         node.name
    55         && (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 === 1
    69         && (childrens[0].type === 'Literal' || childrens[0].type === 'JSXText')
    70         && childrens[0].value.indexOf('\n') !== -1
    71         && childrens[0].value.replace(/(?!\xA0)\s/g, '') === ''
    72       );
    73     }
    74 
    7575    function isShouldBeSelfClosed(node) {
    7676      const configuration = Object.assign({}, optionDefaults, context.options[0]);
Note: See TracChangeset for help on using the changeset viewer.