prettier-eslint-cli: slow performance. How long should it take?

  • prettier-eslint-cli version: 4.1.1
  • prettier version: 0.22.0
  • eslint version: 4.2.0

Relevant code/config.


What you did:

prettier-eslint file.js

What happened:

the prettier command takes less than a second and the prettier-eslint command takes about 4-5 seconds on the same file. Is this a normal execution time?

Reproduction:

– paste your link here –

Problem description:

Suggested solution:

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (3 by maintainers)

Most upvoted comments

Stale issue

While investigating a slow performance of eslint, I found that the most time of what it takes is prettier/prettier:

TIMING=1 yarn lint

Screenshot 2020-05-01 at 12 09 13

For anyone looking for workarounds, if you just run prettier directly instead of running it through ESLint, it runs dramatically faster.

This is what I do in package.json, using TypeScript with create-react-app:

{
  "scripts": {
    "eslint": "eslint --ext \"js,ts,jsx,tsx\" ./src",
    "prettier": "prettier \"src/**/*.{ts,tsx,js,jsx}\"",
    "lint": "yarn prettier --check && yarn eslint",
    "lint:fix": "yarn prettier --write && yarn eslint --fix"
  }
}

something is eating my machine:

 p/dancer $$ TIMING=1 yarn eslint --max-warnings 0 'packages/dancer-feed-db-api/**/*.{ts,js,json,d.ts}' --cache --fix                                                                                                                                                   932ms
yarn run v1.22.4
$ /Users/stavalfi-dev/projects/dancer/node_modules/.bin/eslint --max-warnings 0 'packages/dancer-feed-db-api/**/*.{ts,js,json,d.ts}' --cache --fix
Rule                                       | Time (ms) | Relative
:------------------------------------------|----------:|--------:
prettier/prettier                          |  2087.620 |    94.5%
unused-imports/no-unused-imports           |    19.940 |     0.9%
no-redeclare                               |    11.459 |     0.5%
@typescript-eslint/type-annotation-spacing |     6.720 |     0.3%
jest/no-identical-title                    |     5.282 |     0.2%
json/*                                     |     4.064 |     0.2%
no-misleading-character-class              |     4.025 |     0.2%
no-regex-spaces                            |     3.994 |     0.2%
@typescript-eslint/no-use-before-define    |     3.934 |     0.2%
no-empty-character-class                   |     3.763 |     0.2%
Rule | Time (ms) | Relative
:----|----------:|--------:
✨  Done in 316.94s.     <<<<<<<<<<<<<<------------------- WTF??!
  • with eslint_d i reduced the time to be 60 seconds (but all the files were already fixed with the first command so maybe this test doesn’t say much)

in my case, it was extrimly slow because I worked in a monorepo (with yarn) and each package had huge node_module.

I forced that all packages has the exact same version of all dependnecies so all the packages’s node_module folders become almost empty (all the installations moved to the root node_module).

I reduced the lint duration from 316 seconds to 50 seconds.

still slow as hell but good enough for now.

image Seeing similar