New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement lint-staged #4382
Conversation
Just curious, what's the relation between this and #4330 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much time does this save? Linting is generally quite quick isn't it?
I just did a test and it's brutal
lint-staged the only thing it does is pass the lint only to the files added to git, not all. It also only runs when you commit. My intention is not to fill the project with unnecessary dependencies but this change will help us a lot |
Thank you @frbuceta for the pull request. I agree with you it would be great to have a faster option for running the linter. My experience with pre-commit hooks is not the best, the hook is often run in situations when I don't want it to be executed (e.g. when performing Can we please find a way how to introduce this faster way of running the linter as a new I love the fact that you are limiting both Prettier and Eslint to the staged files only 馃憤 |
@@ -24,8 +25,9 @@ | |||
"eslint-plugin-eslint-plugin": "^2.2.1", | |||
"eslint-plugin-mocha": "^6.2.2", | |||
"fs-extra": "^8.1.0", | |||
"husky": "^3.1.0", | |||
"husky": "^4.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is no longer needed? See https://github.com/strongloop/loopback-next/pull/4639/files
I noticed too that eslint is slow. My wild guess is that the type-based rules from |
I think the gist is that typescript engine is adding delays. I did find an interesting post mentioning speeding up type-based rules. Does it apply to this repo? |
Thank you @dougal83 for the link, the discussion in that issue is interesting and helpful.
Did you mean the following part?
In loopback-next, most of the files are in TypeScript, I believe the only JavaScript files are in I am running eslint with TIMING enabled to better understand which rules are contributing most of the slowness, will post the results once the command finishes.
|
Here are the results:
(Note that eslint prints only 10 slowest rules, see https://github.com/eslint/eslint/blob/b23ad0d789a909baf8d7c41a35bc53df932eaf30/docs/developer-guide/working-with-rules.md#per-rule-performance) (UPDATE) |
I found a possible improvement: remove |
Implementation of lint-staged throughout the project to upload the code without errors
Checklist
馃憠 Read and sign the CLA (Contributor License Agreement) 馃憟
npm test
passes on your machinepackages/cli
were updatedexamples/*
were updated馃憠 Check out how to submit a PR 馃憟