-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 cli option #4330
Conversation
I just uploaded this but please don't accept it yet. I have a couple of doubts...
|
Hi @frbuceta, thank you for the pull request. Did you know that Maybe instead of introducing lint-staged, a better first step is to enable caching mode in the generated projects? Personally, I would be reluctant to rely on git metadata to decide which files to lint. I am concerned that we can miss some files that should have been linted, especially when switching between feature branches and rebasing on top of newer master branch. In my experience, commit hooks are not very fast, which I find annoying and thus prefer to run checks when I decide on my own. Of course, that's just me, other people may have different preferences. I also want to have a CI step to check the linting for code that I didn't wrote myself. We have a pre-commit hook to reject commit messages not following our conventions, and we are still getting pull requests with wrong commit messages. I don't know how that happens, but we must be prepared to cope with it. So even if we enable staged-lint, we still need to run the linting step as part of the CI process. In which case I find it a bit redundant to run the linting step on every commit too. (But again, that's my subjective opinion.) Now your pull request is adding the new behavior behind a feature flag (an option the user can choose or choose not), therefore I am fine to add such feature even if I would not want to use it myself. However, I am not able to provide much feedback on the implementation details.
It looks a bit hacky to me, but it's not the end of the world. I find it surprising that Yeoman is not removing the
Which file are you referring to?
This is a Yeoman-related question (see https://yeoman.io). I am not very familiar with all best practices for writing Yeoman generators and the way how we are applying them to our generator hierarchy, but after a quick search I found the following place where options are handled - I think it can be a good place where to add your new code too. @raymondfeng AFAIK, you are the author of |
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.
Hi @frbuceta, is this pull request still relevant after we fixed eslint caching?
@bajtos It may still be relevant if prettier is a concern? A cached option was in the works but it was not released. |
Yeah, I really wish Prettier supported caching. Few other alternatives we may want to consider:
We need to carefully consider changes in the developer experience that would the different setup bring. E.g. do we want prettier-related formatting problems to be highlighted by VS Code when Prettier is integrated into eslint? Probably not. |
Another option is to use a faster alternative to Prettier, e.g. https://github.com/dprint/dprint |
fixes #4062
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 馃憟