Skip to content

行内忽略注释

对于 JS/TS 文件,使用 oxfmt-ignore 来跳过下一个语句的格式化:

js
// oxfmt-ignore
const a    = 42;

/* oxfmt-ignore */
const x = () => { return 2; };

<>
  {/* oxfmt-ignore */}
  <span   ugly   format=""   />
</>;

对于非 JS 文件,使用 prettier-ignore 注释。另请参阅 Prettier 的 忽略文档

目前,TOML 文件不支持忽略注释。

Prettier 兼容性

  • 也支持 prettier-ignore 注释
  • 由于性能原因,不支持在 JS/TS 文件中使用尾随忽略注释