Skip to content

ESLint hangs indefinitely when prettier is not installed (instead of throwing an error) #781

@isamu

Description

@isamu

Description

When eslint-plugin-prettier is configured in eslint.config.js but prettier itself is not installed as a dependency, ESLint hangs indefinitely without producing any output or error message.

Expected behavior: ESLint should fail fast with a clear error message such as Cannot find module 'prettier'.

Actual behavior: ESLint process hangs forever (no output, no error, no exit). It must be killed manually (e.g., kill or Ctrl+C).

Reproduction Steps

1. Minimal package.json (note: no prettier dependency)

{
  "devDependencies": {
    "@eslint/js": "^10.0.1",
    "eslint": "^10.0.0",
    "eslint-config-prettier": "^10.1.8",
    "eslint-plugin-prettier": "^5.5.4",
    "typescript-eslint": "^8.54.0"
  }
}

2. eslint.config.js

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import prettierConfig from "eslint-config-prettier";
import prettierPlugin from "eslint-plugin-prettier";

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommended,
  prettierConfig,
  {
    plugins: {
      prettier: prettierPlugin,
    },
    rules: {
      "prettier/prettier": "error",
    },
  },
  {
    ignores: ["node_modules/**", "lib/**"],
  }
);

3. Create any TypeScript file

echo 'const x = 1;' > src/test.ts

4. Run ESLint

npx eslint src/test.ts
# → Hangs indefinitely. No output. No error. Must be killed.

5. Install prettier and run again

npm install -D prettier
npx eslint src/test.ts
# → Works correctly. Reports prettier formatting errors and exits.

Debug Output

Running with --debug shows ESLint successfully parses and analyzes the file, but then hangs after scope analysis — presumably when the prettier/prettier rule tries to invoke Prettier:

eslint:languages:js Parsing successful: /path/to/src/test.ts
eslint:languages:js Scope analysis: /path/to/src/test.ts
eslint:languages:js Scope analysis successful: /path/to/src/test.ts
# ← Hangs here forever

Impact

This is particularly problematic because:

  1. No indication of what's wrong — developers waste significant time debugging, as the hang gives no clue that prettier is simply missing.
  2. CI pipelines hang indefinitely instead of failing with a useful error, potentially consuming runner minutes until timeout.
  3. eslint-plugin-prettier imports successfully (since it's installed), so the config file loads without error — the failure only occurs at rule execution time.

We encountered this in a real project: isamu/movie-separate#2

Environment

  • eslint-plugin-prettier: 5.5.4
  • eslint-config-prettier: 10.1.8
  • eslint: 10.0.0 (also reproduced with 9.39.1)
  • typescript-eslint: 8.54.0
  • Node.js: v24.12.0
  • OS: macOS (Darwin 25.2.0 arm64)
  • prettier: not installed (this is the trigger)

Suggested Fix

The plugin should check for prettier availability at rule creation time and throw a descriptive error if it cannot be resolved, e.g.:

Error: eslint-plugin-prettier requires prettier to be installed.
Please run: npm install -D prettier

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions