jsx-eslint/jsx-ast-utils

The prop value with an expression type of BindExpression could not be resolved. Please file issue to get this fixed immediately.

Closed this issue ยท 8 comments

From evcohen/eslint-plugin-jsx-a11y, I got an error when running eslint-plugin-jsx-a11y plugin which uses jsx-ast-utils.

Here is my configuration:

OS: macOS 10.12.4
Running ESLint: v3.19.0
Launched with: eslint command line
Stacktrace:

> ./node_modules/.bin/eslint ./src
The prop value with an expression type of BindExpression could not be resolved.
  Please file issue to get this fixed immediately.
Error: The prop value with an expression type of BindExpression could not be resolved.
  Please file issue to get this fixed immediately.
    at extract (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/index.js:173:11)
    at Object.extractValueFromCallExpression [as CallExpression] (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/CallExpression.js:24:30)
    at extract (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/index.js:176:21)
    at Object.extractValueFromLogicalExpression [as LogicalExpression] (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/LogicalExpression.js:27:37)
    at Object.extract [as JSXExpressionContainer] (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/index.js:176:21)
    at getValue (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
    at extractValue (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
    at getPropValue (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
    at /Users/vivaxy/Developer/react-ui/node_modules/eslint-plugin-jsx-a11y/lib/rules/href-no-hash.js:47:48
    at Array.map (native)

Any chance you could narrow this down to the exact code that it breaks on?

@ljharb that's okay, we don't have any BindExpression parser in this repo. It would be for the following:

::this.foo 
::console.log

getPropValue would return "this.foo.bind(this)" and "console.log.bind(console)"
getLiteralPropValue would return null

I started a branch to work on a fix, but need to update to use babylon for tests instead of acorn-jsx, which wasn't as simple as I had hoped.

@evcohen any update on this? Or a workaround. I'm getting the same error:

The prop value with an expression type of BindExpression could not be resolved.
  Please file issue to get this fixed immediately.
Error: The prop value with an expression type of BindExpression could not be resolved.
  Please file issue to get this fixed immediately.
    at Object.extract [as JSXExpressionContainer] (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/values/expressions/index.js:173:11)
    at getValue (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
    at extractValue (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
    at getPropValue (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
    at /Users/tsheaff/Code/private/calm/www/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:76:95
    at Array.some (native)
    at EventEmitter.JSXOpeningElement (/Users/tsheaff/Code/private/calm/www/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:75:52)
    at emitOne (events.js:101:20)
    at EventEmitter.emit (events.js:191:7)
    at NodeEventGenerator.applySelector (/Users/tsheaff/Code/private/calm/www/node_modules/eslint/lib/util/node-event-generator.js:265:26)
    at NodeEventGenerator.applySelectors (/Users/tsheaff/Code/private/calm/www/node_modules/eslint/lib/util/node-event-generator.js:294:22)

It fails for any file that includes the :: syntax.

any update on this?

#43 is the outstanding PR

please fix this

please fix this

v2.0.1 released with this patch