6

I'm using the latest versions of these packages:

  • ESLint: 8.11.0
  • Prettier: 2.6.0
  • eslint-plugin-prettier: 4.0.0
  • eslint-config-prettier: 8.5.0
Rule Time (ms) Relative
prettier/prettier 156074.280 98.4%
vue/attribute-hyphenation 678.026 0.4%
@typescript-eslint/no-unused-vars 593.419 0.4%
no-redeclare 174.305 0.1%
padding-line-between-statements 145.755 0.1%
vue/valid-next-tick 38.034 0.0%
no-restricted-imports 37.361 0.0%
@typescript-eslint/no-empty-function 37.335 0.0%
@typescript-eslint/no-loss-of-precision 36.425 0.0%
vue/no-async-in-computed-properties 36.114 0.0%

npm run lint 179.28s user 2.19s system 108% cpu 2:47.58 total

and Prettier is taking 98.3% of the total time.

Is there any way to optimize it (by passing a parameter, using some extra package, disabling specific rules, ...)?

Oswaldo
  • 3,296
  • 4
  • 25
  • 35
  • Please don't [re-post](https://stackoverflow.com/q/71528324/3001761), this is no less broad than the last attempt. If you want to discuss a third-party package's performance, see if they have issues on GitHub or a Discord or something. – jonrsharpe Mar 18 '22 at 15:34
  • 1
    this is a totally valid question as someone can have the solution already and others can have the same problem. I'll re-post as many times as you close my question, because this is a genuine question – Oswaldo Mar 18 '22 at 15:41
  • 1
    and please don't use sarcasm as you did in the original question like "clear optimisation would be to not use Prettier", this is just technical question and isn't offending anyone – Oswaldo Mar 18 '22 at 15:43
  • That _wasn't_ sarcasm, that's a technical and correct solution - removing Prettier from your toolchain would save you two and a half minutes. And note that the requirements are not _just_ "someone can have the solution" and "others can have the same problem" (otherwise "what's 2 + 2?" would be on topic). Also if you keep re-posting the same content you'll likely get suspended - if you'd like to advocate for reopening your question see [meta]. – jonrsharpe Mar 18 '22 at 15:46
  • 1
    if I'm asking about a solution regarding Prettier it's obvious that I don't want to get rid of it because it's good for formatting my code, the only problem I currently have is performance. Please respect my time and just let me get an answer for this – Oswaldo Mar 18 '22 at 15:51
  • @Oswaldo: can you say something roughly about the size of the project? I found this question now and I have a fraction of what you have but still too much to run it comfortably as a commit hook. I find that prettier runs fast enough when the IDE runs it only on single files every time I save one of them so I'm thinking of running prettier via IDE/VSCode + (just for verification) in the build pipeline. – Erik I Oct 24 '22 at 11:27
  • 1
    hey @ErikI, it's a big project, that's why it takes more time for me. We also have Prettier plugin in VSCode, but some times we want to check the whole project like in CI for example. I just checked and after a lot of changes in our project and updating packages this is what I get now: ```prettier/prettier | 11629.327 | 79.1%``` – Oswaldo Oct 24 '22 at 16:05

0 Answers0