testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.25k stars 460 forks source link

v8.20.1 - invalid syntax reported by esprima-fb #1294

Closed philipwhiuk closed 3 months ago

philipwhiuk commented 3 months ago

esprima-fb reports invalid syntax:

[17:40:27] Error: Parse Error: Line 71: Unexpected token = while parsing file: [PROJECT}\node_modules\@testing-library\react\node_modules\@testing-library\dom\dist\pretty-dom.js
    at throwError ([PROJECT}\node_modules\esprima-fb\esprima.js:2818:21)
    at throwUnexpected ([PROJECT}\node_modules\esprima-fb\esprima.js:2880:9)

Line 70-73:

  const {
    filterNode = filterCommentsAndDefaultIgnoreTagsTags,
    ...prettyFormatOptions
  } = options;

It seems like it doesn't like the assignment inside {}s. Is this expected to be valid?

eps1lon commented 3 months ago

This is valid JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#default_value.

Maybe IE 11 does not support it but if you need to support IE11, you should probably transpile node_modules anyway.