eslint-plugin-putout

raw JSON β†’
31.1.2 verified Sat Apr 25 auth: no javascript

ESLint plugin for 🐊Putout, a code transformation tool. Current stable version is 31.1.2, released as part of the putout monorepo. The plugin provides ESLint rules that mirror Putout's linting capabilities, including formatting rules like array-element-newline, single-property-destructuring, and tape-specific rules for test files. It requires eslint >=10 and putout >=42. Key differentiator is seamless integration of Putout's code transformations into ESLint workflows, allowing users to leverage both tools in a unified configuration. Release cadence is high (multiple versions per week).

error Cannot find module 'eslint-plugin-putout' ↓
cause Package not installed or wrong import path.
fix
npm i eslint-plugin-putout -D (ensure it's in package.json)
error ESLint: Failed to load plugin 'putout': Cannot find module 'putout' ↓
cause putout peer dependency missing.
fix
npm i putout -D
error TypeError: (0 , eslint_plugin_putout__WEBPACK_IMPORTED_MODULE_0__.default) is not a function ↓
cause Using named import instead of default import for the plugin object.
fix
Use "import putout from 'eslint-plugin-putout'" instead of "import { putout } from 'eslint-plugin-putout'".
error Error: Plugin 'putout' requires eslint >=10 ↓
cause Outdated eslint version.
fix
Update eslint to >=10: npm i eslint@^10 -D
breaking Requires eslint >=10 and putout >=42. Older versions incompatible. ↓
fix Update dependencies: npm i eslint@^10 putout@^42 eslint-plugin-putout@^31 -D
breaking ESM-only package. require() will fail with ERR_REQUIRE_ESM. ↓
fix Use import syntax only; if using CommonJS, consider dynamic import.
deprecated Config presets like recommended and safe are now flat config only; old .eslintrc style presets removed. ↓
fix Use flat config format (eslint.config.js) with import.
gotcha The 'putout' rule internally uses Putout's engine; may conflict with other ESLint formatting rules. ↓
fix Disable conflicting rules (e.g., 'indent', 'max-len') if using putout/putout with fix:true.
gotcha Plugin must be imported as default export, not named exports like { rules }. ↓
fix Use 'import putout from "eslint-plugin-putout"' not 'import { putout } from "eslint-plugin-putout"'.
npm install eslint-plugin-putout
yarn add eslint-plugin-putout
pnpm add eslint-plugin-putout

Demonstrates importing plugin and presets, configuring putout rule with options, and enabling formatting rules in flat config.

// eslint.config.js
import putout from 'eslint-plugin-putout';
import { recommended } from 'eslint-plugin-putout';
import process from 'process';

export default [
  ...recommended,
  {
    plugins: { putout },
    rules: {
      'putout/putout': ['error', {
        fix: true,
        ignores: ['*.d.ts'],
        regex: /\.(js|mjs)$/
      }],
      'putout/array-element-newline': 'error',
      'putout/tape-add-newline-between-tests': 'error'
    }
  }
];