Skip to content

User Guide

💿 Installation

bash
npm install --save-dev eslint eslint-plugin-math

Requirements

  • ESLint v8.57.0 and above
  • Node.js v18.x, v20.x and above

📖 Usage

Configuration

New Config (eslint.config.js)

Use eslint.config.js file to configure rules. See also: https://eslint.org/docs/latest/use/configure/configuration-files-new.

Example eslint.config.js:

js
import eslintPluginMath from 'eslint-plugin-math';
export default [
  // add more generic rule sets here, such as:
  // js.configs.recommended,
  eslintPluginMath.configs.recommended,
  {
    rules: {
      // override/add rules settings here, such as:
      // 'math/prefer-math-trunc': 'error'
    }
  }
];

This plugin provides configs:

  • *.configs.recommended ... Recommended config provided by the plugin.

See the rule list to get the rules that this plugin provides.

Legacy Config (.eslintrc)

Use .eslintrc.* file to configure rules. See also: https://eslint.org/docs/latest/use/configure/.

Example .eslintrc.js:

js
module.exports = {
  extends: [
    // add more generic rulesets here, such as:
    // 'eslint:recommended',
    'plugin:math/recommended-legacy'
  ],
  rules: {
    // override/add rules settings here, such as:
    // 'math/prefer-math-trunc': 'error'
  }
}

This plugin provides configs:

  • plugin:math/recommended-legacy ... Recommended config provided by the plugin.

See the rule list to get the rules that this plugin provides.

❓ FAQ

  • TODO