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

[JENKINS-73744] npm scripts lint:fix do not work #9718

Merged
merged 10 commits into from
Sep 16, 2024

Conversation

scherler
Copy link
Contributor

@scherler scherler commented Sep 11, 2024

See JENKINS-73744.

Testing done

Proposed changelog entries

  • human-readable text

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

@timja timja added the web-ui The PR includes WebUI changes which may need special expertise label Sep 12, 2024
@timja timja requested a review from a team September 12, 2024 08:03
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Please update the CONTRIBUTING guide: https://github.com/jenkinsci/jenkins/blob/master/CONTRIBUTING.md#running-the-yarn-frontend-build

Changes look good although I would like to run locally before approving

@timja timja requested a review from a team September 12, 2024 08:04
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
@janfaracik
Copy link
Contributor

Working locally for me +1 - ran a dev server and tried linting.

I think it makes more sense for first time contributors to have package.json in the root too.

@scherler
Copy link
Contributor Author

scherler#75 I created a PR for the profiles only but I am not sure if that is what @timja had in mind

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

Thanks! I tested locally and linting looks to be fine for me.

@timja
Copy link
Member

timja commented Sep 12, 2024

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Sep 12, 2024
@MarkEWaite MarkEWaite added the skip-changelog Should not be shown in the changelog label Sep 12, 2024
@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Sep 13, 2024
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Sep 13, 2024
@MarkEWaite
Copy link
Contributor

I found that with the most recent changes and a merge of the latest master branch, I needed to add the downloaded versions of Node and Yarn to my path. I did that with the command:

export PATH=$PWD/node:$PWD/node/yarn/dist/bin:$PATH

I have no skills in front-end development, so that may indicate that I'm making some obvious mistake, but when I tried to run yarn without adding it to the PATH, my Linux shell reported command not found.

Once the PATH was updated, I confirmed that yarn lint:fix worked for me when I intentionally modified a JavaScript file to have a formatting error.

@timja
Copy link
Member

timja commented Sep 14, 2024

That’s expected, maven doesn’t add the downloaded yarn and node to the PATH.

@MarkEWaite
Copy link
Contributor

MarkEWaite commented Sep 14, 2024

That’s expected, maven doesn’t add the downloaded yarn and node to the PATH.

Thanks! I think that means the CONTRIBUTING doc should be updated to include the instructions to set the PATH for the new location of node and yarn. I pushed that change as 8e868b5

@daniel-beck
Copy link
Member

In what way does this address JENKINS-73744?

@timja
Copy link
Member

timja commented Sep 14, 2024

@scherler are you happy with that change?

I and most other people doing frontend development are unlikely to use that approach as we'll use what we have locally installed so we don't have to modify our PATH for one project.

Node will read what's in the package.json and automatically load the right version of yarn anyway once you've run corepack enable

@MarkEWaite
Copy link
Contributor

I and most other people doing frontend development are unlikely to use that approach as we'll use what we have locally installed so we don't have to modify our PATH for one project.

Would it be a workable compromise for the less experienced (like me) if there were a section that described the PATH setting without including a link in the later sections to those instructions?

@scherler
Copy link
Contributor Author

scherler commented Sep 16, 2024

@MarkEWaite @timja I will update doc to point out the path facts
^ just saw that you actually did. As Tim said as a frontend dev you would have yarn and node in your path anyway but I guess you than just ignore the note.

@scherler
Copy link
Contributor Author

scherler commented Sep 16, 2024

@daniel-beck I am not sure about the question since the change is addressing the problem and it is now possible to use lint:fix as expected and without having to add the node_modules to the path. This is because moving the node/npm infrastructure to the root folder is installing all node_modules there and next to the config file which formally had failed.

@timja timja merged commit 0037be6 into jenkinsci:master Sep 16, 2024
4 of 8 checks passed
@scherler scherler deleted the JENKINS-73744_alternative branch September 16, 2024 11:47
@basil
Copy link
Member

basil commented Sep 17, 2024

@daniel-beck I am not sure about the question since the change is addressing the problem and it is now possible to use lint:fix as expected and without having to add the node_modules to the path.

Then why does CONTRIBUTING.md still talk about adding to the PATH?

@basil
Copy link
Member

basil commented Sep 19, 2024

And why was the node.version configuration in .github/renovate.json not updated to adjust to the new file path?

@scherler
Copy link
Contributor Author

scherler commented Sep 19, 2024

@basil Actually @MarkEWaite added that note, you only need to add node/yarn to your path if you want to use yarn ... in your jenkins setup without having yarn globally installed on your box. In my case I do not have to do this anymore since I have yarn installed on a global level. Hence #9718 (comment) you would have yarn and node in your path anyway but I guess you than just ignore the note. I was not aware of that config .github/renovate.json but we neither changed the version, but I think you mean

      "fileMatch": [
        "war/pom.xml"
      ],

I will fill a follow-up PR if you do not beat me to it.

@basil
Copy link
Member

basil commented Sep 19, 2024

@scherler The documentation should always reflect what is supported by the project, no more and no less.

  • If usage with PATH modification is supported and usage without PATH modification is unsupported, then this PR should be reverted.
  • If usage with PATH modification is unsupported and usage without PATH modification is supported, then the documentation should be updated to remove references to PATH modification.
  • If usage with or without PATH modification is supported, the documentation should describe both usages.

In any case, this PR (as it was integrated) is logically inconsistent.

@scherler
Copy link
Contributor Author

scherler commented Sep 19, 2024

I will follow up as well to state in the docu what I explained earlier that you only have to add the path if yarn is not installed globally.

you only have to add the following to your path if you do not have it already (due to a global install of node/yarn)

however it will not break anything if you follow that instruction on a system that already has node/yarn installed, so not really sharing your opinion of logically inconsistent

@scherler
Copy link
Contributor Author

@basil #9757

@basil
Copy link
Member

basil commented Sep 19, 2024

so not really sharing your opinion of logically inconsistent

Is there any particular reason to use monospaced text here for the phrase "logically inconsistent"? Did you mean to use quotation marks?

<id>yarn-lint</id>
<activation>
<property>
<name>!env.CI</name>
Copy link
Member

Choose a reason for hiding this comment

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

Why was this PR merged when the mandatory Testing Done section was blank?

Copy link
Contributor

Choose a reason for hiding this comment

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

I should have added notes in the PR description on the testing that I did in the comment. Tim noted in his comment that he tested locally, and Jan noted in his comment that he tested locally.

However, I did not test the Maven profile and should have done that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog web-ui The PR includes WebUI changes which may need special expertise
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants