Skip to content

Upgrade jsx-ast-utils to support Optional Chaining (tracking issue) #747

Closed
@junoatwork

Description

@junoatwork

I opened an issue upstream on jsx-ast-utils: jsx-eslint/jsx-ast-utils#103 . The fix will have to occur there, and then this package should be updated to depend on (or at least accept in the semver range) the new version.

Symptom:

Began seeing The prop value with an expression type of ChainExpression could not be resolved. Please file issue to get this fixed immediately. in eslint output after upgrading.

ECMAscript Optional Chaining shipped, resulting in various changes to parsers and javascript/typescript tools to support it. Initially there were different, non-standard names for the AST nodes to represent it. Over this year, consensus has settled out, including in the parser that eslint uses, estree (see estree/estree#204 ).

Versions:

eslint@7.10.0
jsx-ast-utils@2.4.1 (via eslint-plugin-react@7.21.3, eslint-plugin-jsx-a11y@6.3.1)

Minimal test case

Component.jsx

import React from 'react';

export function Component() {
  const x = {};
  return (
    <div role="button" key={x.y?.z}>
      hi
    </div>
  );
}

.eslintrc

module.exports = {
  extends: [
    'plugin:react/recommended',
    'plugin:jsx-a11y/recommended'
  ],
  plugins: ['react', 'jsx-a11y'],
}

run

eslint ./Component.jsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions