MCPcopy
hub / github.com/tailwindlabs/prettier-plugin-tailwindcss / JSXAttribute

Function JSXAttribute

src/index.ts:633–655  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

631
632 visit(ast, {
633 JSXAttribute(node) {
634 node = node as import('@babel/types').JSXAttribute
635
636 if (!node.value) {
637 return
638 }
639
640 // We don't want to support namespaced attributes (e.g. `somens:class`)
641 // React doesn't support them and most tools don't either
642 if (typeof node.name.name !== 'string') {
643 return
644 }
645
646 if (!matcher.hasStaticAttr(node.name.name)) {
647 return
648 }
649
650 if (isStringLiteral(node.value)) {
651 sortStringLiteral(node.value, { env })
652 } else if (node.value.type === 'JSXExpressionContainer') {
653 sortInside(node.value)
654 }
655 },
656
657 CallExpression(node) {
658 node = node as import('@babel/types').CallExpression

Callers

nothing calls this directly

Calls 4

isStringLiteralFunction · 0.85
sortStringLiteralFunction · 0.85
sortInsideFunction · 0.85
hasStaticAttrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…