Skip to content

Commit 24f0e20

Browse files
committed
📚 TYPOS!!
1 parent 9c7f8ce commit 24f0e20

11 files changed

+24
-26
lines changed

website/docs/authoring.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Which one to use depends on your particular use case.
1414
## 1. Contribute to the Community Folder
1515

1616
The Community Folder is the public directory of codemods hosted and published directly from this repository, [visible here](https://github.com/CodeshiftCommunity/CodeshiftCommunity/tree/main/community).
17-
This directory can be compared to and treated the same as the Typescript type definition regisistry: [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).
17+
This directory can be compared to and treated the same as the Typescript type definition registry: [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped).
1818

1919
_Please see the [Contribution guide](contribution) for more information._
2020

@@ -23,7 +23,7 @@ Use this method if you want:
2323
- Your codemods to be open source
2424
- Build tooling, dependency management and project setup to be handled for you
2525
- The community to help maintain and contribute to your codemods
26-
- Documentation to be automatically generated and available on the [Regisistry page](registry)
26+
- Documentation to be automatically generated and available on the [Registry page](registry)
2727

2828
Do not use this method if:
2929

@@ -46,7 +46,7 @@ Use this method if you want:
4646

4747
Do not use this method if:
4848

49-
- You want docs to be automatically generated and available on the [Regisistry page](registry)
49+
- You want docs to be automatically generated and available on the [Registry page](registry)
5050

5151
## 3. Create a stand-alone codeshift package
5252

website/docs/contribution.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This page covers contribution to the [Community Folder](https://github.com/Codes
99
- Codemods to be open source
1010
- Build tooling, dependency management and project setup to be handled for you
1111
- The community to help maintain and contribute to your codemods
12-
- Documentation to be automatically generated and available on the [Regisistry page](registry)
12+
- Documentation to be automatically generated and available on the [Registry page](registry)
1313

1414
If you prefer to create codemods outside of this repo, please see the [Authoring guide](authoring) for other options.
1515

website/docs/external-packages.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To create a standalone codeshift package automatically, install the install and
1919
- **npm:** `npm install -g @codeshift/cli` or
2020
- **yarn:** `yarn global add @codeshift/cli`
2121

22-
Then given you want to initialize a new project called "foobar", with a codemod targetting version `10.0.0` you can run the following command:
22+
Then given you want to initialize a new project called "foobar", with a codemod targeting version `10.0.0` you can run the following command:
2323

2424
`$ codeshift init --package-name="foobar" --version="10.0.0" ~/Desktop`
2525

website/docs/guides/css-codemods.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ slug: /css-codemods
77
In some cases, it's possible that you may need to write a codemod that applies changes across different programming languages JS, CSS, etc.
88
It could be because the package you're writing a codemod for has an API that spans across both JS and CSS, for example a Design System or CSS-in-JS library. Where some of your consumers may be using the JS interface and some the CSS interface.
99

10-
In this scenario, it's possible to repurpose JSCodeshift to handle this by treating JSCodeshift purely as a "Runner", or in otherwords, as the entrypoint to the files you're looking to modify and substitute a transformation library of your choice.
10+
In this scenario, it's possible to repurpose JSCodeshift to handle this by treating JSCodeshift purely as a "Runner", or in other words, as the entrypoint to the files you're looking to modify and substitute a transformation library of your choice.
1111
For example [PostCSS](https://postcss.org/), [Babel](https://babeljs.io/), etc.
1212

1313
However, this does come with drawbacks, you will no longer have access to JSCodeshift parsers and transformation API. This guide will explain how to handle these yourself.
@@ -91,10 +91,7 @@ const plugin = (): Plugin => {
9191
Declaration: decl => {
9292
if (decl[processed]) return;
9393

94-
decl.prop = decl.prop
95-
.split('')
96-
.reverse()
97-
.join('');
94+
decl.prop = decl.prop.split('').reverse().join('');
9895

9996
decl[processed] = true;
10097
},

website/docs/guides/monorepos.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ ie:
9090

9191
And show an interactive list for you to search and can choose from.
9292

93-
## Publising
93+
## Publishing
9494

9595
The workflow to publishing your codemod enhanced packages should remain completely unchanged.
9696
However, it's important to verify that your `codeshift.config.js` and codemods are not ignored by npm (via `.npmignore` or similar) so that they are successfully published to the registry.

website/docs/guides/prompting-for-human-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Or in other words: **"Insert a comment"**.
1313
Inserting comments as codemod output is a completely valid thing to do and highlights to maintainers that they need to manually complete the migration.
1414
When leaving comments, it's helpful to be as descriptive as possible, including all or as much of the context required for the maintainer.
1515

16-
Comments are also helpful because when a PR is raised, these prompts can easily be seen in the diff and actioned at the maintainers discression. The key is to make the surface area of your codemod known and let maintainers know where they're needed.
16+
Comments are also helpful because when a PR is raised, these prompts can easily be seen in the diff and actioned at the maintainers discretion. The key is to make the surface area of your codemod known and let maintainers know where they're needed.
1717

1818
## Inserting a comment
1919

website/docs/guides/understanding-asts.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Before writing your first codemod, it’s important to first have a good concept
1414

1515
Abstract Syntax Trees can be thought of as simply the object representation of your code after being parsed.
1616
You might already be familiar with the tools and libraries that do this, for example [babeljs](https://babeljs.io/), [recast](https://github.com/benjamn/recast), [eslint](https://eslint.org/) etc.
17-
These tools parse files into ASTs in preperaton for some work, which generally consists of breaking a raw file down into "Nodes" which are then organized and categorized into a hierarchial format that can be reasoned about, manipulated and output back into a file.
17+
These tools parse files into ASTs in preparation for some work, which generally consists of breaking a raw file down into "Nodes" which are then organized and categorized into a hierarchial format that can be reasoned about, manipulated and output back into a file.
1818

1919
![Code — AST — AST(mutated) — Code](/img/ast.png)
2020

@@ -28,7 +28,7 @@ For instance, consider this snippet:
2828
console.log('Hello, World');
2929
```
3030

31-
The way you might catagorise the anatomy of this expression in your mind is probably not too dissimilar to how it's actually done in [recast](https://github.com/benjamn/recast) (which is what is used in this project).
31+
The way you might categorise the anatomy of this expression in your mind is probably not too dissimilar to how it's actually done in [recast](https://github.com/benjamn/recast) (which is what is used in this project).
3232
So now compare it to the actual resulting AST, generated by recast.
3333

3434
```js
@@ -76,7 +76,7 @@ Every [Node](/docs/glossary#node) in this tree is given a "type", these types ar
7676

7777
So for example, if you want to know the arguments this method contains, you could first look at the `arguments` property on the `ExpressionStatement`.
7878
Arguments in functions can be conceptually thought of as arrays, so it's no surprise that we're presented with an array here.
79-
Now we can see that in our array we have one element, which is of the type `StringLiteral` and has it's own meta data attached to it containing the value we're looking for: `Hello, World` – Hooray 🎉.
79+
Now we can see that in our array we have one element, which is of the type `StringLiteral` and has its own metadata attached to it containing the value we're looking for: `Hello, World` – Hooray 🎉.
8080

8181
Great but where do we go from here? Well it totally depends on what you're trying to achieve.
8282
If you want to replace the message that's logged, all you'd have to do is replace the `StringLiteral` node with one containing the appropriate message.
@@ -94,7 +94,7 @@ How can one make sense of it all? Well luckily there are indispensable tools out
9494
![AST Explorer screenshot](/img/astexplorer.png)
9595

9696
It provides a real-time representation of your code as an AST which is inspectable and lets you write and test transforms against it live in the browser.
97-
It also supports other ASTs like babel, typescript etc. so for our usecase we'll need to configure it a bit to support recast + jscodeshift.
97+
It also supports other ASTs like babel, typescript etc. so for our use-case we'll need to configure it a bit to support recast + jscodeshift.
9898

9999
To configure it, follow these steps:
100100

website/docs/guides/your-first-codemod.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Our transform will look something like this.
3535

3636
```ts
3737
export default function transform(file, { jscodeshift: j }, options) {
38-
const source = j(file.source); // (1) Create an AST of the fiven file
38+
const source = j(file.source); // (1) Create an AST of the given file
3939

4040
const imports = source
4141
.find(j.ImportDeclaration) // (2) Find all import declarations!
@@ -50,16 +50,17 @@ export default function transform(file, { jscodeshift: j }, options) {
5050
If you prefer a more declarative approach, you can provide a second argument to `find` describing the expected shape of the node you are looking for.
5151

5252
```ts
53-
const imports = source
54-
.find(j.ImportDeclaration, { source: { value: 'my-module' } }) // Find all import declarations that match this shape
53+
const imports = source.find(j.ImportDeclaration, {
54+
source: { value: 'my-module' },
55+
}); // Find all import declarations that match this shape
5556
```
5657

5758
This behaves like a fuzzy searcher: The more details provided the more narrow the search is.
5859

5960
## Modify & Insert
6061

6162
Now let's say that we want to pull in a new import from 'my-module' called `baz`. Luckily you've already written a majority of the code above.
62-
All we'll need to do now is "insert" an new ImportSpecifier into the ImportDeclaration node that we've just retrieved.
63+
All we'll need to do now is "insert" an new `ImportSpecifier` into the `ImportDeclaration` node that we've just retrieved.
6364

6465
Now inserting can look a little awkward at first, because what we're really doing is building a new node based on what we've found and replacing it with a modified version of itself.
6566

@@ -92,7 +93,7 @@ Now there are a few moving pieces in this example, let's step through them:
9293

9394
(1) Here we "build" a new node of type `ImportSpecifier`.
9495

95-
You can build a node by using the camelCase variant methos of a node type.
96+
You can build a node by using the camelCase variant method of its node type.
9697
So to build an `ImportSpecifier` you use `j.importSpecifier(...)` and when you want to search for one, you use the CapitalCase variant `j.ImportSpecifier`.
9798

9899
(2) Create a new import declaration
@@ -106,7 +107,7 @@ Here we push our new import specifier into the array of existing specifiers.
106107

107108
(4) Replace the node
108109

109-
Finally we replace our ImportDeclaration with our new one and the resulting output should look like this:
110+
Finally we replace our `ImportDeclaration` with our new one and the resulting output should look like this:
110111

111112
```diff
112113
-import { foo, bar } from 'my-module';

website/docs/guiding-principles.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In these cases we recommend that you are aware of [when not to codemod](/docs/wh
3030
## Codemods should do as much as can be safely done automatically or prompt for human intervention
3131

3232
Writing a codemod to completely migrate a package from one working state to another is not always feasible. Some edge cases might simply be too hard to support.
33-
When this is the case, bailing out and pompting for human intervention should be your first fallback.
33+
When this is the case, bailing out and prompting for human intervention should be your first fallback.
3434
This gives consumers a chance to review the changes of the codemod, read the prompts containing context about the changes they need to action and make the remaining manual steps as painless and straight forward as possible.
3535

3636
For more information, please see the [Prompting for human input](/docs/prompting-for-human-input) guide.

website/docs/introduction.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ By consolidating codemods in the same way, the ecosystem can benefit from:
5757
Ultimately, with the wider JS community collaborating to produce high quality versioned codemods, our goal is to achieve solid coverage over common js dependencies (ie react, jest, chalk, etc), in a similar way to how quality type definitions are created and shared within the DefinitelyTyped community.
5858

5959
CodeshiftCommunity provides a similar registry that hosts and automatically publishes codemods for you under the [/community directory](https://github.com/CodeshiftCommunity/CodeshiftCommunity/tree/main/community).
60-
The community directory organizes codemods by package name and version. They are then published to npm as modules that can be retrospectivally patched or improved.
60+
The community directory organizes codemods by package name and version. They are then published to npm as modules that can be retrospectively patched or improved.
6161
This ensures that users running codemods are always getting the latest and greatest version of your codemod.
6262

6363
### Rich documentation
6464

65-
CodeshiftCommunity is a documentation hub first, by provding guides, recipes and reference material we aim demystify codemods, which are often seen as "arcane knowledge".
65+
CodeshiftCommunity is a documentation hub first, by providing guides, recipes and reference material we aim demystify codemods, which are often seen as "arcane knowledge".
6666

6767
With the right documentation and guidance in place, it will be significantly easier to normalize codemods and reduce their learning curve.
6868
We want to remove the stigma that "codemods are hard" or "they take a long time to write" and get everyone into the healthy practice of writing them.

website/docs/recipes/react.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const Button = () => {
209209

210210
### Wrapping components
211211

212-
Wrapping react components with react components is a fairly common opperation.
212+
Wrapping react components with react components is a fairly common operation.
213213

214214
Simply follow this fairly simple set of steps:
215215

0 commit comments

Comments
 (0)