Skip to content
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

chore: migrate linting workflow to use trunk check metalinter #17876

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

EliSchleifer
Copy link

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x ] Other, please explain: chore to migrate linting solution to trunk check - universal metalinter

What changes did you make? (Give an overview)

Trunk is a universal meta-linter and therefore obfuscates the need for separate calls to markdownlint / eslint / etc...

  • Removed markdownlintignore (trunk by default ignores all files in .gitignore and added separately ignore of changelog.md to trunk.yaml)
  • All tools will run in batch mode where possible (eslint, markdownlint, svgo)

I've left in place the current git-hook implementation. I want to make sure the basic ergonomics work before migrating these scripts into trunk actions as well.

Is there anything you'd like reviewers to focus on?

Make sure you like the ergonomics of the tool as currently integrated

@eslint-github-bot
Copy link

Hi @EliSchleifer!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

Copy link

linux-foundation-easycla bot commented Dec 19, 2023

CLA Not Signed

Copy link

netlify bot commented Dec 19, 2023

Deploy Preview for docs-eslint ready!

Name Link
🔨 Latest commit f47ca85
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/65f36c9a6733200008a92b56
😎 Deploy Preview https://deploy-preview-17876--docs-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@EliSchleifer EliSchleifer changed the title chore: migrate linting / static analysis workflow to unified trunk metalinter Chore: migrate linting / static analysis workflow to unified trunk metalinter Dec 19, 2023
@eslint-github-bot
Copy link

Hi @EliSchleifer!, thanks for the Pull Request

The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag wasn't recognized. Did you mean "docs", "fix", or "feat"?
  • There should be a space following the initial tag and colon, for example 'feat: Message'.
  • The first letter of the tag should be in lowercase
  • The length of the commit message must be less than or equal to 72

To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page.

Read more about contributing to ESLint here

@EliSchleifer EliSchleifer changed the title Chore: migrate linting / static analysis workflow to unified trunk metalinter chore: migrate linting workflow to use trunk check metalinter Dec 19, 2023
@eslint-github-bot eslint-github-bot bot added the chore This change is not user-facing label Dec 19, 2023
@nzakas
Copy link
Member

nzakas commented Dec 27, 2023

Thanks for putting this together. It looks like the CI is failing with a message "trunk not found". Is there a way to get this working in CI to see what the output looks like?

We're working on getting our v9.0.0 alpha out this week, so will have more time to investigate this next week.

@EliSchleifer
Copy link
Author

EliSchleifer commented Dec 29, 2023 via email

- name: lint
run: ${workspace}/bin/eslint.js --output-file ${tmpfile} --format json ${target}
enabled:
- [email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if this is needed given the previous definition?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah - the definition teaches trunk how to run a tool - and the enabled list turns on the tools.

- trunk-check-pre-push
- trunk-fmt-pre-commit
enabled:
- trunk-upgrade-available
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Will something like Renovate know to upgrade trunk? Or is this something that needs to happen manually?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently upgrading is manual - we are working on a PR to make renovate aware of our schema.

package.json Outdated
@@ -30,7 +30,8 @@
"test": "node Makefile.js test",
"test:cli": "mocha",
"test:fuzz": "node Makefile.js fuzz",
"test:performance": "node Makefile.js perf"
"test:performance": "node Makefile.js perf",
"trunk": "trunk"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking we'd probably want "lint": "trunk" if the intent is to replace the current linting task?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I just need to extract the json file check and then we're in business

@EliSchleifer EliSchleifer marked this pull request as ready for review January 9, 2024 17:56
@EliSchleifer EliSchleifer requested a review from a team as a code owner January 9, 2024 17:56
@EliSchleifer
Copy link
Author

@nzakas - I think this cleans up all the issues and at least let's you kick tires completely. I didn't see an active GitHub action that ran ESLint on itself - is the lint step right now fully optional?

I can add a trunk check step that would automatically run check on each PR and make sure all rules are being followed.

@nzakas
Copy link
Member

nzakas commented Jan 9, 2024

Because you're a first-time contributor, the lint check doesn't run automatically -- I just manually approved it so it will run now. It's titled "Verify Files" in the actions list.

d Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it was included accidentally?

Comment on lines 29 to 43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these versions correspond to the versions in package.json? I'm just concerned about needing to update two places when these change.

...or do these have no relation to package.json at all?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These have no relation to package.json - I don't think you had/have versions of these tools running there. Some of these tools are nice to have - svgo, oxipng, shfmt, yamllint - nice tools to keep things clean and tidy.

Did you see any tool overlap - agreed - we don't want to have any collision with package.json

d Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geeze - that's a ridiculous file.

@nzakas
Copy link
Member

nzakas commented Jan 11, 2024

I've tried checking this out locally and on my Windows machine I'm getting the following:

$ npm run trunk

> [email protected] trunk
> trunk

The system cannot find the path specified.

I tried running npm install, but it seems that doesn't help. Does trunk work on Windows? Is there something else I need to do get it to work locally?

@EliSchleifer
Copy link
Author

I've tried checking this out locally and on my Windows machine I'm getting the following:

$ npm run trunk

> [email protected] trunk
> trunk

The system cannot find the path specified.

I tried running npm install, but it seems that doesn't help. Does trunk work on Windows? Is there something else I need to do get it to work locally?

The product does work on windows - but not sure we've tested the npm flow - I am not a node/windows expert - but we have those on staff. They're taking a look.

@EliSchleifer
Copy link
Author

two issues here:

  1. I mistakenly changed call to trunk check from CI even though trunk was not on the path - so moved to use npm run
  2. You uncovered a bug in our launcher for windows - having someone from the team fix that up. @nzakas - do you use powershell on your windows box or bash emulation?

@nzakas
Copy link
Member

nzakas commented Jan 16, 2024

I'm using Git Bash.

Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There also exists an eslint-plugin-yml. I suspect it would be good community-dogfooding for ESLint to use that rather than a separate tool. Is that something that can be reasonably done in metalinter without sacrificing features?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me take this as an action item for a follow up to use the eslint yaml plugin.

@nzakas
Copy link
Member

nzakas commented Feb 6, 2024

@EliSchleifer looks like we have the CI failing again on this.

@EliSchleifer
Copy link
Author

on it - also looking into how we can better support the mode of running on docs only in CI and not locally. small product change to make that a better experience and map to what we're aiming for here

@EliSchleifer looks like we have the CI failing again on this.

Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@Tanujkanti4441
Copy link
Contributor

hi @EliSchleifer, you can share the updates regarding this PR or if it is ready to review.

@EliSchleifer
Copy link
Author

I need to update the config - so the verification step is properly modeling the desire to handle CI flow differently from PR local flow. I should be able to update it this week

@@ -33,9 +33,6 @@ jobs:
- name: Check Licenses
run: node Makefile checkLicenses

- name: Lint Docs JS Files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted this a separate step so we could more easily tell where a failure was on a PR.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub action from trunk will annotate the files inline with the issue. Is that not sufficient to get an understanding of the source of the problem.

I can create a sub branch to demonstrate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will those show up on the Discussion tab of the PR? What I'm looking for is the "glance-ability" of a PR so I don't have to switch to the code tab to get a general understanding which CI checks failed. This is key when we are barraged with PRs and trying to triage.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

github-actions bot commented Mar 8, 2024

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@EliSchleifer
Copy link
Author

EliSchleifer commented Mar 14, 2024 via email

@Tanujkanti4441 Tanujkanti4441 mentioned this pull request Mar 14, 2024
1 task
@fasttime
Copy link
Member

fasttime commented May 1, 2024

@EliSchleifer there are merge conflicts. Can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore This change is not user-facing github actions
Projects
Status: Implementing
Development

Successfully merging this pull request may close these issues.

None yet

7 participants