UNPKG

eslint-plugin-react-form-fields

Version:
24 lines (23 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeRule = void 0; const jsxElementsParser_1 = require("./jsxElementsParser"); const collectStyledComponentData_1 = require("./collectStyledComponentData"); const makeRule = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any rule // eslint-disable-next-line @typescript-eslint/no-explicit-any ) => { return { meta: rule.meta, create(context) { const collectedStyledComponents = {}; const jsxElements = []; return Object.assign(Object.assign({}, (0, collectStyledComponentData_1.collectStyledComponentData)(collectedStyledComponents)), { JSXElement: (node) => jsxElements.push(node), 'Program:exit': () => { const parser = (0, jsxElementsParser_1.jsxElementsParser)(context, rule, collectedStyledComponents); jsxElements.forEach((jsxElement) => parser(jsxElement)); } }); }, }; }; exports.makeRule = makeRule;