Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade jsx-ast-utils to support Optional Chaining #2822

Closed
junoatwork opened this issue Oct 9, 2020 · 1 comment
Closed

Upgrade jsx-ast-utils to support Optional Chaining #2822

junoatwork opened this issue Oct 9, 2020 · 1 comment
Assignees

Comments

@junoatwork
Copy link

I opened an issue upstream on jsx-ast-utils: jsx-eslint/jsx-ast-utils#103 , which was fixed in jsx-ast-utils@3.0.0

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
@ljharb ljharb self-assigned this Oct 9, 2020
@ljharb ljharb closed this as completed in b7b023f Oct 9, 2020
@ljharb
Copy link
Member

ljharb commented Oct 9, 2020

The next patch release of eslint-plugin-react will include jsx-ast-utils v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants