Skip to content

Unknown expression type ThisExpression #41

@ljharb

Description

@ljharb

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?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions