Skip to content

Commit 4cea9cf

Browse files
authored
Fix typos (#747)
* typos: fix typos * typos: fix capitalization * whitespace: remove trailing whitespace * tree-sitter: remove executable permission from WASM files They're not actually directly executable, so remove the bit.
1 parent c99048f commit 4cea9cf

23 files changed

+25
-25
lines changed

website/advanced/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ If your rule depends on using meta variables in later rules, the best way is to
197197

198198
## `kind` and `pattern` rules are not working together, why?
199199

200-
The most common scneario is that your pattern is parsed as a different AST node than you expected. And you may use `kind` rule to filter out the AST node you want to match. This does not work in ast-grep for two reasons:
200+
The most common scenario is that your pattern is parsed as a different AST node than you expected. And you may use `kind` rule to filter out the AST node you want to match. This does not work in ast-grep for two reasons:
201201
1. tree-sitter, the underlying parser library, does not offer a way to parse a string of a specific kind. So `kind` rule cannot be used to change the parsing outcome of a `pattern`.
202202
2. ast-grep rules are mostly independent of each other, except sharing meta-variables during a match. `pattern` will behave the same regardless of another `kind` rule.
203203

website/blog/new-ver-38.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ One of the exciting new additions is the `labels` field for your rule configurat
3434

3535
![Example of Customizable Code Highlighting](/image/blog/labels-demo.png)
3636

37-
But the benefits don't stop at individual understanding. The labels field offers a fantastic way to embed more guidance directly into your rules, and it allow you to share coding best practices, style guide reminders, or domain-specific knowledge across your entire team. This feature helps disseminate expertise and maintain consistency effortlessly. For example, [Sam Wight](https://github.com/samwightt), the lables feature's proposer, is using ast-grep to help his team to write better [Angular code](/catalog/typescript/missing-component-decorator.html)!
37+
But the benefits don't stop at individual understanding. The labels field offers a fantastic way to embed more guidance directly into your rules, and it allow you to share coding best practices, style guide reminders, or domain-specific knowledge across your entire team. This feature helps disseminate expertise and maintain consistency effortlessly. For example, [Sam Wight](https://github.com/samwightt), the labels feature's proposer, is using ast-grep to help his team to write better [Angular code](/catalog/typescript/missing-component-decorator.html)!
3838

3939
![Example of VSCode](/image/blog/labels-vscode.jpeg)
4040

website/blog/optimize-ast-grep.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ ast-grep can match an AST node by rules, and those rules can be composed togethe
114114
For example, the rule `any: [rule1, rule2]` is a composite rule that consists of two sub-rules and the composite rule matches a node when either one of the sub-rules matches the node.
115115
This can be expensive since multiple rules must be tried for every node to see if they actually make a match.
116116

117-
I have already forsee it so every rule in ast-grep has an optimzation called `potential_kinds`. AST node in tree-sitter has its own type encoded in a unsigned number called `kind`.
117+
I have already forsee it so every rule in ast-grep has an optimization called `potential_kinds`. AST node in tree-sitter has its own type encoded in a unsigned number called `kind`.
118118
If a rule can only match nodes with specific kinds, then we can avoid calling `match_node` for nodes if its kind is not in the `potential_kinds` set.
119119
I used a BitSet to encode the set of potential kinds. Naturally the `potential_kinds` of composite rules can be constructed by merging the `potential_kinds` of its sub-rules, according to their logic nature.
120120
For example, `any`'s potential_kinds is the union of its sub-rules' potential_kinds, and `all`'s potential_kinds is the intersection of its sub-rules' potential_kinds.

website/blog/stars-6000.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ As ast-grep continues to grow, we remain committed to providing a tool that not
9393
![sponsors](/image/blog/sponsor2.png)
9494

9595

96-
We thank each and every one of you, espeically ast-grep's sponsors, for your support, contributions, and feedback that have shaped ast-grep into what it is today. Here's to many more milestones ahead!
96+
We thank each and every one of you, especially ast-grep's sponsors, for your support, contributions, and feedback that have shaped ast-grep into what it is today. Here's to many more milestones ahead!

website/blog/typed-napi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class SgNode<M extends TypesMap, K extends Kinds<M> = Kinds<M>> {
170170
}
171171
```
172172

173-
It represents a node in a language with type map `M` that has a specific kind `K`. e.g. `SgNode<TypeScript, "function_declaration">` means a function declaration node in TypeScript. When used without a specific kind parameter, `SgNode` defaults to accepting any valid node kind in the language.
173+
It represents a node in a language with type map `M` that has a specific kind `K`. E.g. `SgNode<TypeScript, "function_declaration">` means a function declaration node in TypeScript. When used without a specific kind parameter, `SgNode` defaults to accepting any valid node kind in the language.
174174

175175
`SgNode` provides a **correct** AST interface in a specific language. While at the same time, it is still **robust** enough to not trigger compiler error when no type information is available.
176176

website/catalog/python/recursive-rewrite-type.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Suppose we want to transform Python's `Union[T1, T2]` to `T1 | T2` and `Optional
99

1010
By default, ast-grep will only fix the outermost node that matches a pattern and will not rewrite the inner AST nodes inside a match. This avoids unexpected rewriting or infinite rewriting loop.
1111

12-
So if you are using non-recurisve rewriter like [this](https://github.com/ast-grep/ast-grep/discussions/1566#discussion-7401382), `Optional[Union[int, str]]` will only be converted to `Union[int, str] | None`. Note the inner `Union[int, str]` is not enabled. This is because the rewriter `optional` matches `Optional[$TYPE]` and rewrite it to `$TYPE | None`. The inner `$TYPE` is not processed.
12+
So if you are using non-recursive rewriter like [this](https://github.com/ast-grep/ast-grep/discussions/1566#discussion-7401382), `Optional[Union[int, str]]` will only be converted to `Union[int, str] | None`. Note the inner `Union[int, str]` is not enabled. This is because the rewriter `optional` matches `Optional[$TYPE]` and rewrite it to `$TYPE | None`. The inner `$TYPE` is not processed.
1313

14-
However, we can apply `rewriters` to inner types recursively. Take the `optional` rewriter as an example, we need to apply rewriters, `optional` and `unioins`, **recursively** to `$TYPE` and get a new variable `$NT`.
14+
However, we can apply `rewriters` to inner types recursively. Take the `optional` rewriter as an example, we need to apply rewriters, `optional` and `unions`, **recursively** to `$TYPE` and get a new variable `$NT`.
1515

1616
### YAML
1717
```yml

website/catalog/python/refactor-pytest-fixtures.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ utils:
3131
3232
Pytest fixtures are declared with a decorator `@pytest.fixture`. We match the `function_definition` node that directly follows a `decorator` node. That decorator node must have a `fixture` identifier somewhere. This accounts for different location of the `fixture` node depending on the type of imports and whether the decorator is used as is or called with parameters.
3333

34-
Pytest functions are fairly straghtforward to detect, as they always start with `test_` by convention.
34+
Pytest functions are fairly straightforward to detect, as they always start with `test_` by convention.
3535

3636
The next utils builds onto those two to incrementally:
3737
- Find if a node is inside a pytest context (test/fixture)

website/catalog/typescript/find-import-identifiers.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ rule:
5959
- has:
6060
field: source
6161
pattern: $SOURCE
62-
62+
6363
# REGULAR IMPORTS
6464
# ------------------------------------------------------------
6565
# import { ORIGINAL } from 'SOURCE'
@@ -79,7 +79,7 @@ rule:
7979
field: source
8080
pattern: $SOURCE
8181

82-
# DYNAMIC IMPORTS (Single Variable Assignment)
82+
# DYNAMIC IMPORTS (Single Variable Assignment)
8383
# ------------------------------------------------------------
8484
# const VAR_NAME = require('SOURCE')
8585
# ------------------------------------------------------------
@@ -105,7 +105,7 @@ rule:
105105
- has: { field: function, regex: '^(require|import)$' }
106106
- has: { field: arguments, has: { kind: string, pattern: $SOURCE } } # Capture source
107107

108-
# DYNAMIC IMPORTS (Destructured Shorthand Assignment)
108+
# DYNAMIC IMPORTS (Destructured Shorthand Assignment)
109109
# ------------------------------------------------------------
110110
# const { ORIGINAL } = require('SOURCE')
111111
# ------------------------------------------------------------
@@ -136,7 +136,7 @@ rule:
136136
- has: { field: arguments, has: { kind: string, pattern: $SOURCE } } # Capture source
137137
stopBy: end # Search ancestors to find the correct variable_declarator
138138

139-
# DYNAMIC IMPORTS (Destructured Alias Assignment)
139+
# DYNAMIC IMPORTS (Destructured Alias Assignment)
140140
# ------------------------------------------------------------
141141
# const { ORIGINAL: ALIAS } = require('SOURCE')
142142
# ------------------------------------------------------------
@@ -177,7 +177,7 @@ rule:
177177
stopBy: end # Search ancestors to find the correct variable_declarator
178178
stopBy: end # Ensure we check ancestors for the variable_declarator
179179

180-
# DYNAMIC IMPORTS (Side Effect / Source Only)
180+
# DYNAMIC IMPORTS (Side Effect / Source Only)
181181
# ------------------------------------------------------------
182182
# require('SOURCE')
183183
# ------------------------------------------------------------
@@ -198,7 +198,7 @@ rule:
198198
kind: lexical_declaration
199199
stopBy: end # Search all ancestors up to the root
200200

201-
# NAMESPACE IMPORTS
201+
# NAMESPACE IMPORTS
202202
# ------------------------------------------------------------
203203
# import * as ns from 'mod'
204204
# ------------------------------------------------------------
@@ -216,7 +216,7 @@ rule:
216216
field: source
217217
pattern: $SOURCE
218218

219-
# SIDE EFFECT IMPORTS
219+
# SIDE EFFECT IMPORTS
220220
# ------------------------------------------------------------
221221
# import 'mod'
222222
# ------------------------------------------------------------
@@ -289,10 +289,10 @@ const asyncDynamicModule = await import('./async_dynamic1').then(module => modul
289289
const { originalIdentifier: aliasedDynamicImport} = await import('./async_dynamic2');
290290

291291
// Comments in imports
292-
import /* test */ {
292+
import /* test */ {
293293
// Comment in import
294-
commentedImport
295-
} from './commented'; // End of line comment
294+
commentedImport
295+
} from './commented'; // End of line comment
296296
```
297297

298298
### Contributed by

website/guide/project/lint-rule.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ The label config object contains two fields: the required `style` and the option
166166
* `secondary` provides additional context for a diagnostic.
167167
* `message` specifies the message to be displayed along with the label.
168168

169-
Note, a `label` meta-variable must have a corresponding AST node in the matched code because highlighting requires a range in the code for label. That is, the **label meta-variables must be defined in `rule` or `constraints`**. meta-variables in `transform` cannot be used in `labels` as they are not part of the matched AST node.
169+
Note, a `label` meta-variable must have a corresponding AST node in the matched code because highlighting requires a range in the code for label. That is, the **label meta-variables must be defined in `rule` or `constraints`**. Meta-variables in `transform` cannot be used in `labels` as they are not part of the matched AST node.
170170

171171
---
172172

website/guide/rewrite-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ This is because it has two spaces indentation as a part of the fix string, and t
173173

174174
**ast-grep rule can only fix one target node at one time by replacing the target node text with a new string.**
175175

176-
Using `fix` string alone is not enough to handle complex cases where we need to delete surrounding nodes like a comma, or to change surrounding brackets. We may leave redundant text in the fixed code because we cannot delete the surrounding trivias around the matched node.
176+
Using `fix` string alone is not enough to handle complex cases where we need to delete surrounding nodes like a comma, or to change surrounding brackets. We may leave redundant text in the fixed code because we cannot delete the surrounding trivials around the matched node.
177177

178178
To accommodate these scenarios, ast-grep's `fix` also accepts an advanced object configuration that specifies how to fix the matched AST node: `FixConfig`. It allows you to expand the matched AST node range via two additional rules.
179179

website/guide/rewrite/transform.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sometimes, we may want to apply some transformations to the meta variables in th
1010

1111
A transformation object has a key indicating which string operation will be performed on the meta variable, and the value of that key is another object (usually with the source key). Different string operation keys expect different object values.
1212

13-
The following is an example illustring the syntax of a transformation object:
13+
The following is an example illustrating the syntax of a transformation object:
1414

1515
```yaml
1616
transform:

website/public/parsers/tree-sitter-c.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-css.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-elixir.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-go.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-json.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-rust.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-swift.wasm

100755100644
File mode changed.

website/public/parsers/tree-sitter-tsx.wasm

100755100644
File mode changed.

website/public/tree-sitter.wasm

100755100644
File mode changed.

website/reference/rule.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pattern:
4343

4444
---
4545

46-
You can also use `strictness` to change the matching algorithm of pattern. See the [deep div doc](/advanced/match-algorithm.html) for more detailed explanation for strictness.
46+
You can also use `strictness` to change the matching algorithm of pattern. See the [deep dive doc](/advanced/match-algorithm.html) for more detailed explanation for strictness.
4747

4848
**Example**:
4949

website/reference/sgconfig.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ A string specifies where to discover test cases for ast-grep.
5252

5353
A string path relative to `testDir` that specifies where to store test snapshots for ast-grep.
5454
You can think it like `__snapshots___` in popular test framework like jest.
55-
If this option is not specified, ast-grep will store the snapshot under the `__snapshots__` folder undert the `testDir`.
55+
If this option is not specified, ast-grep will store the snapshot under the `__snapshots__` folder under the `testDir`.
5656

5757
Example:
5858

@@ -94,7 +94,7 @@ languageGlobs:
9494
The above configuration tells ast-grep to treat the files with `.vue`, `.svelte`, and `.astro` extensions as HTML files, and the extension-less file `.eslintrc` as JSON files. It also overrides the default parser for C files and TS files.
9595

9696

97-
:::tip Simliar languages
97+
:::tip Similar languages
9898
This option can override the default language parser for a specific file extension, which is useful for rule reuse between similar languages like C/Cpp, or TS/TSX.
9999
:::
100100

website/reference/yaml.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ id: no-console-log
3131
* type: `String`
3232
* required: true
3333

34-
Specify the language to parse and the file extension to includ in matching.
34+
Specify the language to parse and the file extension to include in matching.
3535

3636
Valid values are: `C`, `Cpp`, `CSharp`, `Css`, `Go`, `Html`, `Java`, `JavaScript`, `Kotlin`, `Lua`, `Python`, `Rust`, `Scala`, `Swift`, `Thrift`, `Tsx`, `TypeScript`
3737

0 commit comments

Comments
 (0)