#18230·babel

@babel/eslint-parser: PropertyDefinition 和 AccessorProperty 的模板元素范围不一致

作者: jpradelle创建于 2026年9月9日更新于 2026年9月11日
标签i: needs triage

问题描述

  • 是否想要修复此问题?

您如何使用 Babel?

@babel/eslint-parser

输入代码

我无法在 Babel REPL 中重现此问题。以下是一个包含 4 个文件的项目,用于重现此问题: with-accessor.js

javascript
class Test {
  /**/accessor foo = html`
    <foo-baz icon="${' '}" action="${' '}"></foo-baz>
  `;
}

without-accessor.js

javascript
class Test {
  /*accessor*/ foo = html`
    <foo-baz icon="${' '}" action="${' '}"></foo-baz>
  `;
}

(template elements 在这 2 个文件中的位置相同。