{"id":21186035,"url":"https://github.com/codemodsquad/flow-codemorphs","last_synced_at":"2025-06-12T22:06:31.160Z","repository":{"id":40783601,"uuid":"242459693","full_name":"codemodsquad/flow-codemorphs","owner":"codemodsquad","description":"general purpose codemods for flow","archived":false,"fork":false,"pushed_at":"2023-01-05T08:03:11.000Z","size":3532,"stargazers_count":4,"open_issues_count":21,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-28T03:50:27.141Z","etag":null,"topics":["codemods","flow","jscodeshift"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemodsquad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-23T05:03:48.000Z","updated_at":"2020-10-07T22:31:45.000Z","dependencies_parsed_at":"2023-02-03T19:30:58.521Z","dependency_job_id":null,"html_url":"https://github.com/codemodsquad/flow-codemorphs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/codemodsquad/flow-codemorphs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemodsquad%2Fflow-codemorphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemodsquad%2Fflow-codemorphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemodsquad%2Fflow-codemorphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemodsquad%2Fflow-codemorphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemodsquad","download_url":"https://codeload.github.com/codemodsquad/flow-codemorphs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemodsquad%2Fflow-codemorphs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259539134,"owners_count":22873341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codemods","flow","jscodeshift"],"created_at":"2024-11-20T18:20:54.361Z","updated_at":"2025-06-12T22:06:31.138Z","avatar_url":"https://github.com/codemodsquad.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flow-codemorphs\n\n[![CircleCI](https://circleci.com/gh/codemodsquad/flow-codemorphs.svg?style=svg)](https://circleci.com/gh/codemodsquad/flow-codemorphs)\n[![Coverage Status](https://codecov.io/gh/codemodsquad/flow-codemorphs/branch/master/graph/badge.svg)](https://codecov.io/gh/codemodsquad/flow-codemorphs)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![npm version](https://badge.fury.io/js/flow-codemorphs.svg)](https://badge.fury.io/js/flow-codemorphs)\n\ngeneral purpose codemods for flow\n\n# Table of Contents\n\n\u003c!-- toc --\u003e\n\n- [makeExact](#makeexact)\n- [makeInexact](#makeinexact)\n- [makeReadOnly](#makereadonly)\n\n\u003c!-- tocstop --\u003e\n\n# makeExact\n\nConverts object shape types to exact objects.\n\n## Options\n\n`ambiguousOnly` - if truthy, only ambiguous object shape types will be converted.\n\nYou can pass `selectionStart` and `selectionEnd` options to only convert types within that\nrange. If `selectionStart === selectionEnd`, only converts the type annotation containing\nthe cursor, unless no type annotation contains the cursor, in which case it converts\neverything.\n\n## Example\n\n### Before\n\n```ts\n\n// @flow\n\ntype Foo = {\n  bar: number,\n  baz: Array\u003c{\n    qux: number,\n    blah: $ReadOnly\u003c{\n      blsdf: string,\n    }\u003e,\n    glorb: {a: number}[],\n    ...\n  }\u003e,\n}\n\n```\n\n### Command\n\n```\njscodeshift -t path/to/flow-codemorphs/makeExact.js \u003cfile\u003e\n```\n\n### After\n\n```ts\n\n// @flow\n\ntype Foo = {|\n  bar: number,\n  baz: Array\u003c{|\n    qux: number,\n    blah: $ReadOnly\u003c{| blsdf: string |}\u003e,\n    glorb: {| a: number |}[],\n  |}\u003e,\n|}\n\n```\n\n# makeInexact\n\nConverts object shape types to inexact objects.\n\n## Options\n\n`ambiguousOnly` - if truthy, only ambiguous object shape types will be converted.\n\nYou can pass `selectionStart` and `selectionEnd` options to only convert types within that\nrange. If `selectionStart === selectionEnd`, only converts the type annotation containing\nthe cursor, unless no type annotation contains the cursor, in which case it converts\neverything.\n\n## Example\n\n### Before\n\n```ts\n\n// @flow\n\ntype Foo = {|\n  bar: number,\n  baz: Array\u003c{\n    qux: number,\n    blah: $ReadOnly\u003c{|\n      blsdf: string,\n    |}\u003e,\n    glorb: {a: number}[],\n    ...\n  }\u003e,\n|}\n\n```\n\n### Command\n\n```\njscodeshift -t path/to/flow-codemorphs/makeInexact.js \u003cfile\u003e\n```\n\n### After\n\n```ts\n\n// @flow\n\ntype Foo = {\n  bar: number,\n  baz: Array\u003c{\n    qux: number,\n    blah: $ReadOnly\u003c{ blsdf: string, ... }\u003e,\n    glorb: { a: number, ... }[],\n    ...\n  }\u003e,\n  ...\n}\n\n```\n\n# makeReadOnly\n\nConverts mutable object shape and array types to readonly types.\n\n## Options\n\nYou can pass `selectionStart` and `selectionEnd` options to only convert types within that\nrange. If `selectionStart === selectionEnd`, only converts the type annotation containing\nthe cursor, unless no type annotation contains the cursor, in which case it converts\neverything.\n\n## Example\n\n### Before\n\n```ts\n// @flow\n\ntype Foo = {\n  bar: number\n  baz: Array\u003c{\n    qux: number\n    blah: $ReadOnly\u003c{\n      blsdf: string\n    }\u003e\n    glorb: { a: number }[]\n  }\u003e\n}\n```\n\n### Command\n\n```\njscodeshift -t path/to/flow-codemorphs/makeReadOnly.js \u003cfile\u003e\n```\n\n### After\n\n```ts\n// @flow\n\ntype Foo = $ReadOnly\u003c{\n  bar: number\n  baz: $ReadOnlyArray\u003c\n    $ReadOnly\u003c{\n      qux: number\n      blah: $ReadOnly\u003c{\n        blsdf: string\n      }\u003e\n      glorb: $ReadOnlyArray\u003c$ReadOnly\u003c{ a: number }\u003e\u003e\n    }\u003e\n  \u003e\n}\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemodsquad%2Fflow-codemorphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemodsquad%2Fflow-codemorphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemodsquad%2Fflow-codemorphs/lists"}