eslint-plugin-jsx-a11y: Unknown expression type `ThisExpression`

on v1.0.1:

TYPES[expression.type] is not a function
TypeError: TYPES[expression.type] is not a function
    at extract ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/values/expressions/index.js:102:32)
    at Object.extractValueFromMemberExpression [as MemberExpression] ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/values/expressions/MemberExpression.js:23:30)
    at extract ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/values/expressions/index.js:102:32)
    at Object.extractValueFromMemberExpression [as MemberExpression] ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/values/expressions/MemberExpression.js:23:30)
    at Object.extract [as JSXExpressionContainer] ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/values/expressions/index.js:102:32)
    at getValue ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/values/index.js:52:27)
    at extractValue ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/getAttributeValue.js:24:12)
    at getAttributeValue ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/util/getAttributeValue.js:41:10)
    at EventEmitter.JSXOpeningElement ($PWD/node_modules/eslint-plugin-jsx-a11y/lib/rules/img-has-alt.js:56:54)
    at emitOne (events.js:82:20)
    at EventEmitter.emit (events.js:169:7)

I added a console.log to line 101 in index.js and got:

Node {
  type: 'ThisExpression',
  start: 1419,
  end: 1423,
  loc: 
   SourceLocation {
     start: Position { line: 54, column: 17 },
     end: Position { line: 54, column: 21 } },
  range: [ 1419, 1423 ] }

Perhaps the comment "This will map correctly for *all* possible expression types." above the function is inaccurate, and it should be explicitly handling unknown expression types?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (14 by maintainers)

Most upvoted comments

Just published v1.0.2 let me know if you face any other issues. I’m going to work on better error handling right now for every rule.

Fixed ConditionalExpression handler in v1.0.4

thanks @ivarni will get you a fix for that right now and work on error handling today.

sure, perhaps with the filename and line number