eslint-plugin-finlint
v1.0.0
Published
ESLint plugin for financial math accuracy
Maintainers
Readme
eslint-plugin-finlint
ESLint plugin for financial math accuracy — 13 rules that catch precision bugs in JavaScript and TypeScript.
Install
npm install eslint-plugin-finlint --save-devUsage (ESLint v9+ Flat Config)
// eslint.config.js
import finlint from 'eslint-plugin-finlint';
export default [finlint.configs.recommended];Rules
| Rule | Default | Description |
|------|---------|-------------|
| finlint/no-float-money | warn | Financial variables should use Decimal, not number |
| finlint/decimal-from-string | error | Decimal constructor should use string, not number literal |
| finlint/money-parse | error | Don't use Number()/parseFloat() on money strings |
| finlint/intl-number-format | warn | Use Intl.NumberFormat instead of toFixed() |
| finlint/joint-ownership-sum-check | warn | Validate joint ownership percentages sum to 100% |
| finlint/income-split-denominator-nonzero | error | Guard against zero income in split calculations |
| finlint/income-basis-consistency | error | Don't mix gross/net income in splits |
| finlint/aggregate-leaks-complement | error | Don't leak partner data via total - partner |
| finlint/set-union-aggregation | error | Deduplicate shared accounts before aggregation |
| finlint/no-math-round-money | warn | Don't use Math.round/floor/ceil on money |
| finlint/intl-format-only | warn | Don't use string concat for money display |
| finlint/negative-zero-check | warn | Use Object.is() to guard against -0 |
| finlint/no-json-number-parse | error | Use a reviver with JSON.parse for financial data |
TypeScript
Works with @typescript-eslint/parser — FIN001 also detects number type annotations.
License
Apache-2.0 — github.com/kanso-finance/finlint
