eslint-plugin-prettier: eslint-plugin-prettier is very slow
What version of eslint
are you using?
v7.2.0
What version of prettier
are you using?
v2.0.5
What version of eslint-plugin-prettier
are you using?
v3.1.3
Please paste any applicable config files that you’re using (e.g. .prettierrc
or .eslintrc
files)
{
"extends": [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:promise/recommended",
"plugin:prettier/recommended"
],
"plugins": [
"import",
"promise"
],
"env": {
"node": true,
"es2017": true,
"browser": true,
"commonjs": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"globals": {
"Component": true,
"Page": true,
"wx": true,
"App": true
},
"ignorePatterns": [
"dist/*",
"examples/dist/*",
"src/common/async-validator/*",
"examples/pages/filter/components/wemark"
],
"rules": {
"space-before-function-paren": "off",
"indent": ["error", 2,{
"SwitchCase":1
}],
"quotes": [
"error", "single", {
"allowTemplateLiterals": false
}
],
"semi": ["error"],
"no-console": [
"warn", {
"allow": ["info", "warn", "error"]
}
],
"no-undef": "error",
"no-useless-escape": "off",
"eqeqeq": ["error", "always"],
"promise/always-return": "off"
}
}
{
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"quoteProps": "preserve",
"printWidth": 120
}
What source code are you linting? JavaScript、JSON、LESS What did you expect to happen? less time What actually happened? It takes a long time
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 40
- Comments: 26 (4 by maintainers)
Commits related to this issue
- feat: use prettier outside eslint https://github.com/christophehurpeau/pob/commit/445e2cc4def17c3eef1da69c9112dcc1d9e005ce#diff-df15dc66e5815ea34cf86fb16ce789512f2d366a59aa63ce0cf87a96d12cb813 https:... — committed to ornikar/shared-configs by christophehurpeau 3 years ago
- feat: use prettier outside eslint https://github.com/christophehurpeau/pob/commit/445e2cc4def17c3eef1da69c9112dcc1d9e005ce#diff-df15dc66e5815ea34cf86fb16ce789512f2d366a59aa63ce0cf87a96d12cb813 https:... — committed to ornikar/shared-configs by christophehurpeau 3 years ago
eslint: 8.11.0 prettier: 2.6.0 eslint-plugin-prettier: 4.0.0
This should be fixed as of v3.3.0.
I’ve known for a while that not clearing the prettier config cache is the fix for this but wanted to see if there was a way to get the performance speedup without impacting usage in editors - as with this change eslint plugins in editors keep using old cached prettier config instead of spotting when you make changes to prettier config.
The solution is easy but not ideal: “When you make a config change you may need to restart your editor for it to notice”. I couldn’t find fix that avoided that, but the size of the speedup is worth needing that extra step as 99% of the time you’re not fiddling with settings.
@BPScott Can this problem be solved?
Seeing the same thing:
package.json
.eslintrc.js
I had a large js file with 30K line of code in my project’s root directory. adding it to the .prettierignore file solved the issue for me. so, I think that the issue is not with the prettier plugin it’s related to projects, just look for the large files and prettierignore it.
I was reading a tweet regarding this today and thought I should give it a try, I was surprised to see the results (this is a React Native, Typescript codebase).
TIMING=1 npm run lint
:cat package.json | grep -E "eslint|prettier"
:cat .prettierrc.js
:cat .eslintrc.js
:I’m not accustomed with prettier cli’s API so I don’t know how to trigger the Timing=1 to compare the results, neither could I capture the output of
eslint --debug
’s output in order to do anything meaningful with the results (they show up on the screen too fast and then are not piped to stdoutnpm run lint -- --debug > res.txt
).This may help someone: I was able to reduce the time from 4 seconds to 370ms on my small project by creating a .prettierignore file:
Same here, prettier takes a lot of time, which results in really bad developer experience