Skip to main content

no-loss-of-precision

Disallow literal numbers that lose precision.

🧱

This is an "extension" rule that replaces a core ESLint rule to work with TypeScript. See Rules > Extension Rules.

已弃用

此规则已被弃用,因为基本 eslint/no-loss-of-precision 规则增加了对 数字分隔符 的支持。不再需要使用此扩展规则。

¥This rule has been deprecated because the base eslint/no-loss-of-precision rule added support for numeric separators. There is no longer any need to use this extension rule.

选项

See eslint/no-loss-of-precision's options.

如何使用

eslint.config.mjs
export default tseslint.config({
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"
}
});

在线运行试试这个规则 ↗

'## 资源'

Taken with ❤️ from ESLint core.