Skip to content

Replacements for jsx-ast-utils

jsx-ast-utils-x

jsx-ast-utils-x is a zero‑dependency alternative to jsx-ast-utils that aims to maintain API compatibility while reducing package size.

ts
import { hasProp } from 'jsx-ast-utils'
import { hasProp } from 'jsx-ast-utils-x'

import hasProp from 'jsx-ast-utils/hasProp'
import hasProp from 'jsx-ast-utils-x/hasProp'

module.exports = (context) => ({
  JSXOpeningElement: (node) => {
    const onChange = hasProp(node.attributes, 'onChange')
    if (onChange) {
      context.report({ node, message: 'No onChange!' })
    }
  },
})

Released under the MIT License. (4f884625)