-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ci): fix ci lint step #2988
Conversation
Forcefully thrown a lint error in this CI: https://github.com/vitejs/vite/pull/2988/checks?check_run_id=2342427599#step:5:21 |
Interesting note: the removed disable-lint-line only throws an error if the package wasn't build yet 😅 Therefore the example is a bit bad, cause CI succeeds with it 😄 @patak-js this raises the discussion in my head: should the lint be done before or after the build? should it depend on build? |
@patak-js could you provide initial feedback for commit 04e80a6 I may add a step after that to ask for proceed or not to proceed 🤔 I'm I on the right direction at all? |
You know a lot more about this than me, I trust your judgment here. If you need feedback from others, maybe Anthony or other members have more experience. |
Ping @antfu 🙂 |
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.
Small comment, but I think the approach makes sense 👍🏼
Co-authored-by: nihalgonsalves <[email protected]>
This PR would also fix occurrences of multiple lint warnings in a PR like this: |
Is this still a draft @Shinigami92 or we could merge it? |
I had this still as a draft because I wasn't sure myself if I covered everything But IMO we can merge it / it will not break anything, and still if... You know where to contact me 😆 |
scripts/release.js
Outdated
if (pkg.scripts.lint != null) { | ||
step('\nLint package...') | ||
await run('yarn', ['lint']) | ||
} |
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.
@Shinigami92 we discussed this with Anthony and it is better to avoid changing the release process. Isn't linting already being checked during prebuild anyways and in the CI? In any case, I think it would be good that we are able to merge this so if you think this is important maybe we could discuss it in a separate PR.
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.
Yeah, thinking we can just remove this addition to the release script and the rest LGTM.
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 added this especially here, cause I removed it from the package.json
's prebuild
!
Also (I don't know why), but in special cases the lint of packages/vite:lint
catches some other lint as the mono-root lint. That may have to do something with building the dist
folder and checking if it was build so it can be required
.
It needs to be removed from the prebuild
step, cause it would always be triggered in the CI and therefore trigger linting multiple times (see #2988 (comment))
And yeah, linting is not that relevant as tests, but it safes a bit more stability
If I understand it correctly, if the lint fails here (exit code 1), then only the version number in package.json
would be bumped up, but only locally and it wasn't committed or tagged already to somewhere. So this is not a problem at all.
Should I still remove it?
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.
Another option could be to have a ci-build step that doesnt lint
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.
Could you explain/propose a bit more? prebuild
is just called before build
by npm automatically. That's the main issue here currently.
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 we should keep linting in prebuild not because of the release process, but because it helps when modifying Vite before sending a PR. It is a good idea to me that the build step lints (in the same way that it checks typing) so people can feel more confident before sending a PR. I don't think we should force them to run the linting on the side (nobody would remember). We had this discussion with @Shinigami92, where the focus was the release process, but to me what is important is the regular build process. If you would like to remove linting from release, I think it is fine, but let's avoid removing it from prebuild.
About the ci-
scripts, that is one way to achieve this, and it is already being used before this PR in ci-docs
for example.
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.
But we have pre commit hooks for this? 🤔
Lines 57 to 72 in 6dde32a
"gitHooks": { | |
"pre-commit": "lint-staged", | |
"commit-msg": "node scripts/verifyCommit.js" | |
}, | |
"lint-staged": { | |
"*.js": [ | |
"prettier --write" | |
], | |
"*.ts": [ | |
"eslint", | |
"prettier --parser=typescript --write" | |
], | |
"*.html": [ | |
"prettier --write" | |
] | |
} |
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.
Ok, your call then 👍🏼
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 could try (later in another PR) to use pre-commit
with prettier --write
and eslint
for everything
Also for md
and other files, so we have a consistent code base over the whole repo
I think I will come this evening to have a last look into this PR and make a decision
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 created a task for me to check prettier and eslint: #3261
IMO lets just merge this PR for now, so the main issue of multiple occurrences in PR reviews are solved
Co-authored-by: nihalgonsalves <[email protected]>
Description
fixes #2986
Additional context
The CI runs build-vite and this triggers the prebuild of the vite package
This is currently done because it safes one script step for the release process
Todos:
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).