Comments (15)
Stale issue
from prettier-eslint-cli.
While investigating a slow performance of eslint, I found that the most time of what it takes is prettier/prettier
:
TIMING=1 yarn lint
from prettier-eslint-cli.
from prettier-eslint-cli.
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.
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.
from prettier-eslint-cli.
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.
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.
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.
You might try some of the tips in the troubleshooting guide 😄
from prettier-eslint-cli.
I'm also experiencing this (though for me its not the only one):
from prettier-eslint-cli.
Suffering from the same issue.
from prettier-eslint-cli.
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.
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.
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)
- support directory as argument HOT 3
- Is it possible to provide a `--check` option like prettier? HOT 2
- I have problem about this package, HOT 1
- eslint error: Configuration for rule "import/order" is invalid HOT 1
- What different beween use prettier-eslint-cli and use prettier and eslint step by step? HOT 3
- Can an error be reported when the error cannot be resolved? HOT 1
- `--list-different` doesn't exclude node_modules HOT 1
- `--list-different` from script fails HOT 1
- Error: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '' HOT 4
- Error after updating eslint to 8.1.0 HOT 8
- Still reports "jsxBracketSameLine is deprecated." even when option is not used HOT 1
- Option to fix only `layout` issues HOT 1
- Add --cache option HOT 1
- incompatibility with Next eslint config HOT 11
- [v7] bump dependencies HOT 1
- Maintainace: replace `semantic-release` with `changesets` HOT 12
- Support Yarn Plug n Play HOT 1
- Failed to load plugin 'react-hooks' declared in 'CLIOptions' HOT 1
- Support for Prettier 3 (TypeError: Expected `input` to be a `string`, got `object`) HOT 1
- Allow prettier-eslint-cli to write eslint errors/warnings to stderr? HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-eslint-cli.