Skip to content

Commit

Permalink
tweak docs
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Dec 3, 2023
1 parent 266c57a commit 76a12e9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
6 changes: 3 additions & 3 deletions docs/rules/guard_for_in.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ items in your for loop.
### Invalid:

```typescript
for (key in obj) {
for (const key in obj) {
foo(obj, key);
}
```

### Valid:

```typescript
for (key in obj) {
for (const key in obj) {
if (Object.hasOwn(obj, key)) {
foo(obj, key);
}
}
```

```typescript
for (key in obj) {
for (const key in obj) {
if (!Object.hasOwn(obj, key)) {
continue;
}
Expand Down
2 changes: 0 additions & 2 deletions docs/rules/no_console.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# no_console

Disallows the use of the `console` global.

Oftentimes, developers accidentally commit `console.log`/`console.error`
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no_deprecated_deno_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ deprecated ones with alternatives from `std`. For more detail, see
expression. See [deno#9294](https://github.com/denoland/deno/issues/9294) for
more details.

**File system API"
**File system API**

- `Deno.File`

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no_import_assertions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Disallows the `assert` keyword for import attributes

ES import attributes (previously called import assetions) has been changed to
ES import attributes (previously called import assertions) has been changed to
use the `with` keyword. The old syntax using `assert` is still supported, but
deprecated.

Expand Down
22 changes: 11 additions & 11 deletions src/rules/guard_for_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,36 +110,36 @@ mod tests {
fn guard_for_in_valid() {
assert_lint_ok! {
GuardForIn,
r#"for (key in obj);"#,
r#"for (const key in obj);"#,
r#"
for (key in obj)
for (const key in obj)
if (Object.hasOwn(obj, key)) {}
"#,
r#"
for (key in obj) {
for (const key in obj) {
if (Object.hasOwn(obj, key)) {}
}
"#,
r#"
for (key in obj) {
for (const key in obj) {
if (!Object.hasOwn(obj, key)) continue;
}
"#,
r#"
for (key in obj) {
for (const key in obj) {
if (!Object.hasOwn(obj, key)) continue;
foo(obj, key);
}
"#,
r#"
for (key in obj) {
for (const key in obj) {
if (!Object.hasOwn(obj, key)) {
continue;
}
}
"#,
r#"
for (key in obj) {
for (const key in obj) {
if (!Object.hasOwn(obj, key)) {
continue;
}
Expand All @@ -156,22 +156,22 @@ for (key in obj) {
MESSAGE,
HINT,
r#"
for (key in obj)
for (const key in obj)
foo(obj, key);
"#: [{ line: 2, col: 0 }],
r#"
for (key in obj) {
for (const key in obj) {
foo(obj, key);
}
"#: [{ line: 2, col: 0 }],
r#"
for (key in obj) {
for (const key in obj) {
foo(obj, key);
bar(obj, key);
}
"#: [{ line: 2, col: 0 }],
r#"
for (key in obj) {
for (const key in obj) {
if (!Object.hasOwn(obj, key)) {
foo(obj, key);
continue;
Expand Down

0 comments on commit 76a12e9

Please sign in to comment.