Skip to content
← Back to rules

eslint/no-multi-str 样式

它的作用

不允许多行字符串。

为什么这不好?

有些人认为这是一种不好的做法,因为它最初是 JavaScript 的一个未文档化特性,后来才被正式规范化。

示例

以下是此规则的错误代码示例:

javascript
var x =
  "第 1 行 \
 第 2 行";

如何使用

To enable this rule using the config file or in the CLI, you can use:

json
{
  "rules": {
    "no-multi-str": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  rules: {
    "no-multi-str": "error",
  },
});
bash
oxlint --deny no-multi-str

版本

此规则在 v0.5.3 中添加。

参考资料