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

Bump jscodeshift to ^0.15.2 #34680

Merged
merged 12 commits into from
Apr 11, 2024
Merged

Bump jscodeshift to ^0.15.2 #34680

merged 12 commits into from
Apr 11, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Oct 9, 2022

Mend Renovate

closes #36173

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
jscodeshift ^0.13.1 -> ^0.15.2 age adoption passing confidence
@types/jscodeshift (source) 0.11.5 -> 0.11.11 age adoption passing confidence

Release Notes

facebook/jscodeshift (jscodeshift)

v0.15.2

Compare Source

Fixed

v0.15.1

Compare Source

Changed
Fixed

v0.15.0

Compare Source

Changed
Fixed

v0.14.0

Compare Source

Added
Changed
  • Bumped dependency versions
  • Allow arguments in --help to be listed in an order other than alphabetically, so they can instead be grouped thematically (#​507, @​elonvolo)
  • Allow the j shortcut in test utils (#​515, @​no23reason)

Configuration

📅 Schedule: Branch creation - "on sunday before 6:00am" in timezone UTC, Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the dependencies Update of dependencies label Oct 9, 2022
@mui-bot
Copy link

mui-bot commented Oct 9, 2022

Netlify deploy preview

https://deploy-preview-34680--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 92b8a2a

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 10, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 956dc0c to a0f02a0 Compare October 10, 2022 18:06
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Oct 10, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from a0f02a0 to 7078000 Compare October 14, 2022 20:44
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 14, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 7078000 to 17a2955 Compare October 19, 2022 01:08
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

The output looks wrong, it generates duplicate brackets. cc @siriwatknp

@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 17a2955 to 4f0dfcf Compare October 27, 2022 13:58
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 31, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 4f0dfcf to 5d62c80 Compare October 31, 2022 10:10
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Oct 31, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch 3 times, most recently from 3b4351e to f424e73 Compare November 7, 2022 17:23
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch 2 times, most recently from 125097f to 876f52a Compare November 9, 2022 19:07
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 9, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 876f52a to dbc323f Compare November 9, 2022 23:42
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 9, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 1, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from dbc323f to 1d6295f Compare December 1, 2022 15:17
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 1, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 1d6295f to 8c31857 Compare December 6, 2022 11:04
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 6, 2022
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 8c31857 to 4c30610 Compare December 6, 2022 17:13
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 6, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 29, 2024
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from 183fd28 to c2febc9 Compare March 29, 2024 06:09
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels Mar 29, 2024
@renovate renovate bot force-pushed the renovate/jscodeshift-0.x branch from c2febc9 to 865372d Compare April 3, 2024 17:29
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Apr 3, 2024
@siriwatknp
Copy link
Member

I think we should merge this dep update for v6. I assume that most projects have code formatting tools like prettier. I am updating the tests.

Copy link
Contributor Author

renovate bot commented Apr 10, 2024

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

Warning: custom changes will be lost.

@Janpot
Copy link
Member

Janpot commented Apr 10, 2024

How about in mui-codemod we just run prettier on a file ourselves after the jscodeshift, if we detect a prettier setup?

@siriwatknp
Copy link
Member

siriwatknp commented Apr 11, 2024

How about in mui-codemod we just run prettier on a file ourselves after the jscodeshift, if we detect a prettier setup?

I am thinking about detecting double ((*)) and removing it, so that I don't have to change all of the expected tests. Let me try the prettier.

@@ -162,6 +162,11 @@ function run(argv) {

runJscodeshiftTransform(codemod, files, flags, argv._);
runPostcssTransform(codemod, files);
if (!flags.skipPrettier) {
childProcess.spawnSync('prettier', ['--write', `prettier --write $(git diff --name-only)`], {
Copy link
Member

Choose a reason for hiding this comment

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

Feels a bit heavy to spawn an extra process, wouldn't it be possible as a jscodeshift transformer?

import * as prettier from 'prettier';

export default async function transformer(file) {
  const prettierConfig = await prettier.resolveConfig(file.path);
  return prettier.format(file.source, prettierConfig);
}

Almost feels like those APIs were made for each other 😄

Copy link
Member

Choose a reason for hiding this comment

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

  1. We need to add prettier as a dependency, so using npx will be a bit slower, right?
  2. Adding this requires a lot of changes to the expected files. I try to avoid it.

Copy link
Member

@Janpot Janpot Apr 11, 2024

Choose a reason for hiding this comment

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

  1. there could be a one time cost in some cases, looks like prettier total install size is about 50% of jscodeshift total install size (total size = package + dependencies). I'm not sure npx install time is something we should optimize for here, ideally this will be run at most once ever over the lifetime of a project.
  2. I suppose you can still make it optional with a skipPrettier flag

Copy link
Member

Choose a reason for hiding this comment

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

  1. ideally this will be run at most once ever over the lifetime of a project

If the codemod release a new version, isn't another installation is required?

I suppose you can still make it optional with a skipPrettier flag

Yes, it can be skipped.

Copy link
Member

Choose a reason for hiding this comment

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

I tried timing the installation of jscodeshift alone and also jscodeshift and prettier together and the difference seems to be insignificant (<10ms)

Comment on lines 86 to 93
} else if (!flags.skipPrettier) {
try {
childProcess.execSync('prettier --write $(git diff --name-only)', {
stdio: 'inherit',
});
} catch (error) {
// silentyly ignore errors
}
Copy link
Member

@siriwatknp siriwatknp Apr 11, 2024

Choose a reason for hiding this comment

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

Tested, with the CSB build, it works fine. @Janpot what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Personally I don't think we should do it this way. I suppose the idea of ignoring all errors is to ignore when prettier is not installed. But this will also silence any other useful error. For instance, in large projects this will potentially generate a large amount of file names, which can result in failures in the shell as there are limits to the command length. We've ran into this ourselves with code infra with our prettier command and this is the reason why we now use a tool that runs prettier programmatically.

I think we should run prettier programmatically on every file if:

  1. there is a straightforward way to run it e.g. through a jscodeshift transformer
  2. there is a straightforward way to turn it off with a flag
  3. there is a straightforward way to turn it off when no prettier config exists in the project

If any of these 3 conditions is impossible, I'd consider not adding prettier formatting at all.

Copy link
Member

Choose a reason for hiding this comment

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

which can result in failures in the shell as there are limits to the command length

I think it's an edge case because the prettier only runs on changed files. I used to run codemod on several large projects (backstage is one of them) but I've never found a case where file changes go beyond hundreds before.

Anyway, in case there is an error, --skip-prettier can be used.

Copy link
Member

Choose a reason for hiding this comment

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

What we could do is to not add prettier at first and see the feedback. I will remove it for now.

Copy link
Member

Choose a reason for hiding this comment

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

I ended up here after running the deprecations codemod in our docs. I had some files present the double parens issue. In my case, it was easy to bypass running prettier manually. It wasn't that bad. I wouldn't complain if prettier was ran automatically, maybe as an opt-in.

Copy link
Member

Choose a reason for hiding this comment

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

We should at least add a warning for this in the codemod readme.

@siriwatknp siriwatknp requested a review from Janpot April 11, 2024 14:49
@siriwatknp siriwatknp merged commit 17eea99 into next Apr 11, 2024
19 checks passed
@siriwatknp siriwatknp deleted the renovate/jscodeshift-0.x branch April 11, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Update of dependencies on hold There is a blocker, we need to wait
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@mui/codemod: Transformation error (did not recognize object of type "TSSatisfiesExpression")
6 participants