ESLint plugin for Math object and Number linting. Current version 0.13.1, peer dependency ESLint >=8.57.0, requires Node ^18 or >=20. Provides ~30 rules including prefer-math-trunc, prefer-math-pow, prefer-number-is-finite. Supports flat config (eslint.config.js) and legacy .eslintrc. Offers a recommended config and fixable suggestions. Built on eslint-type-tracer for efficient type detection. Designed to catch common Math/Number anti-patterns and promote modern alternatives. Notable for its focus on correctness (e.g., prefer-math-sum-precise for floating point).
npm install eslint-plugin-mathVerified import paths — ran on the pinned version, not inferred.
Shows how to use the plugin with flat config, including recommended config and custom rules.
Upgrade ESLint to >=8.57.0 or pin plugin to <0.10.0.
Upgrade Node to ^18 or >=20 or pin plugin to <0.10.0.
Use 'plugin:math/recommended-legacy' in .eslintrc files. Flat config users should use eslintPluginMath.configs.recommended.
Use `import eslintPluginMath from 'eslint-plugin-math'` or `import { configs } from 'eslint-plugin-math'`.Remove the option; behavior is now default.
Use `import eslintPluginMath from 'eslint-plugin-math'` in an ESM context or use dynamic import.
Run `npm install --save-dev eslint-plugin-math eslint` and ensure config references the plugin correctly.
Check rule docs and use 'error' or 'warn' if still supported; or use 'off' to disable.