Giter Site home page Giter Site logo

Comments (15)

github-actions avatar github-actions commented on May 19, 2024 19

Stale issue

from prettier-eslint-cli.

Hatko avatar Hatko commented on May 19, 2024 18

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

from prettier-eslint-cli.

tony avatar tony commented on May 19, 2024 3

image

from prettier-eslint-cli.

osdiab avatar osdiab commented on May 19, 2024 3

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"
  }
}

from prettier-eslint-cli.

stavalfi avatar stavalfi commented on May 19, 2024 2

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)

from prettier-eslint-cli.

firebluetom2 avatar firebluetom2 commented on May 19, 2024 1

image
Seeing similar

from prettier-eslint-cli.

stavalfi avatar stavalfi commented on May 19, 2024 1

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.

from prettier-eslint-cli.

kentcdodds avatar kentcdodds commented on May 19, 2024

Yes, prettier-eslint is fairly slow. But it shouldn't be that show (unless your file is huge or your computer is underpowered). There hasn't been a lot of effort to optimize prettier-eslint though. Would you like to look into it to try and optimize things?

from prettier-eslint-cli.

jeffwillette avatar jeffwillette commented on May 19, 2024

I'm afraid im not too good with the newer javascript ecosystem but I can take a look. Can you think of anything (I might have goofed something simple) that would make the process run so slow? It is a regular react project created with create-react-app so I do not think that the project size is an issue

from prettier-eslint-cli.

kentcdodds avatar kentcdodds commented on May 19, 2024

You might try some of the tips in the troubleshooting guide 😄

from prettier-eslint-cli.

osdiab avatar osdiab commented on May 19, 2024

I'm also experiencing this (though for me its not the only one):

Screen Shot 2020-06-01 at 20 24 13

from prettier-eslint-cli.

sefabaser avatar sefabaser commented on May 19, 2024

Suffering from the same issue.

from prettier-eslint-cli.

hpetev avatar hpetev commented on May 19, 2024

I noticed that this happens on saving even on a very small file like this one:

it("should pass", () => {
  expect(true).toEqual(true);
});

when a I save package.json before that getting an error: Saving 'package.json': Running 'Prettier - Code formatter' Formatter (configure). Then it becomes slow on all the files. After restart/reinstall starts working fast again until package.json is saved again.

from prettier-eslint-cli.

tony avatar tony commented on May 19, 2024

I'm in the same boat - on the other hand - I'm hoping someone does a Golang/Rust alternative for eslint, in general. It's just too slow, even with prettier disabled. Even on simple typescript codebases.

While this doesn't build/work yet, following this: deno lint

from prettier-eslint-cli.

jiacai2050 avatar jiacai2050 commented on May 19, 2024

https://www.reddit.com/r/neovim/comments/mrep3l/speedup_your_prettier_formatting_using_prettierd/

Prettierd seems a possible solution.

from prettier-eslint-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.