Skip to content

行内忽略注释

🌐 Inline ignore comments

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

🌐 For JS/TS files, use oxfmt-ignore to skip formatting the next statement:

js
// oxfmt-ignore
const a    = 42;

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

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

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

🌐 For non-JS files, use prettier-ignore comment. See also Prettier's ignore documentation.

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

🌐 Currently, TOML files do not support ignore comments.

Prettier 兼容性

🌐 Prettier compatibility

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