Skip to content

Commit

Permalink
Merge branch 'main' into useless-fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Nov 29, 2024
2 parents 6a9f07d + c9b8aec commit d6817ed
Show file tree
Hide file tree
Showing 111 changed files with 1,907 additions and 207 deletions.
78 changes: 50 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "deno_lint"
version = "0.68.0"
version = "0.68.1"
edition = "2021"
description = "lint for deno"
authors = ["the Deno authors"]
Expand All @@ -25,7 +25,7 @@ default = []
docs = []

[dependencies]
deno_ast = { version = "0.43.0", features = ["scopes", "transforms", "utils", "visit", "view", "react"] }
deno_ast = { version = "0.44.0", features = ["scopes", "transforms", "utils", "visit", "view", "react"] }
log = "0.4.20"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,4 @@ Before submitting, please make sure the following is done:
1. Run `cargo build --example dlint --all-features`
2. Update docs by running the generated binary with these arguments
`./target/debug/examples/dlint rules --json > www/static/docs.json`
3. Update schema via `deno task update-schemas`
21 changes: 21 additions & 0 deletions docs/rules/button_has_type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Checks that a `<button>` JSX element has a valid `type` attribute. The default
value is `"submit"` which is often not the desired behavior.

### Invalid:

```tsx
<button />
<button type="foo" />
<button type={condition ? "foo" : "bar"} />
<button type={foo} />
<button type={2} />
```

### Valid:

```tsx
<button type="submit" />
<button type="button" />
<button type="reset" />
<button type={condition ? "button" : "submit"} />
```
16 changes: 16 additions & 0 deletions docs/rules/jsx_boolean_value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Enforce a consistent JSX boolean value style. Passing `true` as the boolean
value can be omitted with the shorthand syntax.

### Invalid:

```tsx
const foo = <Foo isFoo={true} />;
const foo = <Foo isFoo={false} />;
```

### Valid:

```tsx
const foo = <Foo isFoo />;
const foo = <Foo isFoo={false} />;
```
17 changes: 17 additions & 0 deletions docs/rules/jsx_curly_braces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Ensure consistent use of curly braces around JSX expressions.

### Invalid:

```tsx
const foo = <Foo foo=<div /> />;
const foo = <Foo str={"foo"} />;
const foo = <div>{"foo"}</div>;
```

### Valid:

```tsx
const foo = <Foo foo={<div />} />;
const foo = <Foo str="foo" />;
const foo = <div>foo</div>;
```
15 changes: 15 additions & 0 deletions docs/rules/jsx_no_children_prop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Pass children as JSX children instead of as an attribute.

### Invalid:

```tsx
<div children="foo" />
<div children={[<Foo />, <Bar />]} />
```

### Valid:

```tsx
<div>foo</div>
<div><Foo /><Bar /></div>
```
19 changes: 19 additions & 0 deletions docs/rules/jsx_no_duplicate_props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Disallow duplicated JSX props. Later props will always overwrite earlier props
often leading to unexpected results.

### Invalid:

```tsx
<div id="1" id="2" />;
<App a a />;
<App a {...b} a />;
```

### Valid:

```tsx
<div id="1" />
<App a />
<App a {...b} />
<App {...b} b />
```
18 changes: 18 additions & 0 deletions docs/rules/jsx_props_no_spread_multi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Spreading the same expression twice is typically a mistake and causes
unnecessary computations.

### Invalid:

```tsx
<div {...foo} {...foo} />
<div {...foo} a {...foo} />
<Foo {...foo.bar} {...foo.bar} />
```

### Valid:

```tsx
<div {...foo} />
<div {...foo.bar} a />
<Foo {...foo.bar} />
```
18 changes: 18 additions & 0 deletions docs/rules/jsx_void_dom_elements_no_children.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Ensure that void elements in HTML don't have any children as that is not valid
HTML. See
[`Void element` article on MDN](https://developer.mozilla.org/en-US/docs/Glossary/Void_element)
for more information.

### Invalid:

```tsx
<br>foo</br>
<img src="a.jpg">foo</img>
```

### Valid:

```tsx
<br />
<img src="a.jpg" />
```
Loading

0 comments on commit d6817ed

Please sign in to comment.