-
Notifications
You must be signed in to change notification settings - Fork 663
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
ci: check for changes to lints separate from writing changes #2117
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2117 +/- ##
=======================================
Coverage 91.66% 91.66%
=======================================
Files 38 38
Lines 10317 10317
Branches 647 647
=======================================
Hits 9457 9457
Misses 848 848
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
📝 Leaving a few notes for the kind reviewers!
I was running into interesting strangeness in the CI matrix and left a note on changes from that 👁️🗨️
- name: Configure git settings (Windows) | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf |
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.
This step is added to not convert files to ending lines with \r\n
after a checkout.
Some searching hints at .gitattributes
being an option for converting files to \n
endings before a commit, which might be an option if lintings begin to fail due to files being committed with \r\n
!
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.
is there a reason why the files' ending lines are converted to this? I'm guessing we're getting rid of those ending lines because it's clashing with the linter's parsing?
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.
It seems to be a Windows default as far as I can tell 🤔
Some suggestions add the following to .gitattributes
to prefer lf
but that might break editing experiences on certain setups that expect the \r\n
:
* text eol=lf
And some repos treat text files as binary to never change endings on checkout:
* -text
That last example is so interesting to me. The linter does expect \n
in all cases and was erroring if that wasn't found, and I'm hoping this change in CI is an alright enough workaround for matching expected line endings 👾
"lint": "npx @biomejs/biome check .", | ||
"lint:fix": "npx @biomejs/biome check --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.
This change is matched across all packages using biome
🙏
"*": [ | ||
"./types/*" | ||
] | ||
"*": ["./types/*"] |
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.
Other changes are made to fix errors from npm run 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.
what error would be thrown without this change?
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.
$ npx @biomejs/biome check .
./tsconfig.json format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Formatter would have printed the following content:
17 17 │ "baseUrl": ".",
18 18 │ "paths": {
19 │ - ······"*":·[
20 │ - ········"./types/*"
21 │ - ······]
19 │ + ······"*":·["./types/*"]
22 20 │ },
23 21 │ "esModuleInterop": true
····· │
27 25 │ // "resolveJsonModule": true,
28 26 │ },
29 │ - ··"include":·[
30 │ - ····"src/**/*"
31 │ - ··],
32 │ - ··"exclude":·[
33 │ - ····"src/**/*.spec.*"
34 │ - ··],
27 │ + ··"include":·["src/**/*"],
28 │ + ··"exclude":·["src/**/*.spec.*"],
35 29 │ "jsdoc": {
36 30 │ "out": "support/jsdoc",
Checked 9 files in 3ms. No fixes applied.
Found 1 error.
check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Some errors were emitted while running checks.
An expection of an inlined list. What a beautiful error message this is 🤧
My output even shows diff
with red and green 🚙 💨 TBH I would've kept the separate lines but I agree with the linter 🙏
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.
This is even an error that was changed with automagic 🪄 Quite impressive! ✨
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.
PR generally LGTM, thanks for doing this! 🙇 left a few questions mostly for curiosity purposes
"*": [ | ||
"./types/*" | ||
] | ||
"*": ["./types/*"] |
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.
what error would be thrown without this change?
@hello-ashleyintech 🙏 Thank you for another fast review! I'm glad a few updates from the linter were caught here, and I'm wondering if future updates from the great @dependabot might cause errors here? 👁️🗨️ For now, I think we're alright to merge these changes, but open to following up with other changes around line endings or similar! 🚢 |
Summary
This PR adds the
lint:fix
job to write changes needed for linting to pass. Thenpm run lint
command is changed to just check for changes. That'll cause CI to fail if changes are needed!This matches the changes discussed in slack-samples/bolt-ts-starter-template#131 and follows slackapi/bolt-js#2357.
Preview
Before changes
https://github.com/slackapi/node-slack-sdk/actions/runs/12128359302/job/33814593433#step:8:11
After changes
Found in the action logs of this PR!
Requirements