Skip to main content

no-loss-of-precision

Disallow literal numbers that lose precision.

ESLint 配置 中扩展"plugin:@typescript-eslint/recommended" 可启用此规则。


此规则扩展了基本 eslint/no-loss-of-precision 规则。 它增加了对 数字分隔符 的支持。

英:This rule extends the base eslint/no-loss-of-precision rule. It adds support for numeric separators.

如何使用

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "error"
}
};
在线运行试试这个规则 ↗

选项

参见 eslint/no-loss-of-precision 选项

资源

摘自 ❤️ ESLint 内核