mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-28 06:20:15 -04:00
chore: lint identity pipe callbacks (#45771)
This commit is contained in:
+38
@@ -0,0 +1,38 @@
|
||||
id: no-identity-pipe
|
||||
snapshots:
|
||||
schema.pipe((value) => value):
|
||||
labels:
|
||||
- source: schema.pipe((value) => value)
|
||||
style: primary
|
||||
start: 0
|
||||
end: 29
|
||||
schema.pipe((value) => { return value }):
|
||||
labels:
|
||||
- source: schema.pipe((value) => { return value })
|
||||
style: primary
|
||||
start: 0
|
||||
end: 40
|
||||
"schema.pipe((value: Schema) => value)":
|
||||
labels:
|
||||
- source: "schema.pipe((value: Schema) => value)"
|
||||
style: primary
|
||||
start: 0
|
||||
end: 37
|
||||
"schema.pipe((value: Schema) => { return value })":
|
||||
labels:
|
||||
- source: "schema.pipe((value: Schema) => { return value })"
|
||||
style: primary
|
||||
start: 0
|
||||
end: 48
|
||||
schema.pipe(value => value):
|
||||
labels:
|
||||
- source: schema.pipe(value => value)
|
||||
style: primary
|
||||
start: 0
|
||||
end: 27
|
||||
schema.pipe(value => { return value }):
|
||||
labels:
|
||||
- source: schema.pipe(value => { return value })
|
||||
style: primary
|
||||
start: 0
|
||||
end: 38
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
id: no-identity-pipe-tsx
|
||||
snapshots:
|
||||
const view = <Widget value={schema.pipe((value) => value)} />:
|
||||
labels:
|
||||
- source: schema.pipe((value) => value)
|
||||
style: primary
|
||||
start: 28
|
||||
end: 57
|
||||
const view = <Widget value={schema.pipe((value) => { return value })} />:
|
||||
labels:
|
||||
- source: schema.pipe((value) => { return value })
|
||||
style: primary
|
||||
start: 28
|
||||
end: 68
|
||||
"const view = <Widget value={schema.pipe((value: Schema) => value)} />":
|
||||
labels:
|
||||
- source: "schema.pipe((value: Schema) => value)"
|
||||
style: primary
|
||||
start: 28
|
||||
end: 65
|
||||
"const view = <Widget value={schema.pipe((value: Schema) => { return value })} />":
|
||||
labels:
|
||||
- source: "schema.pipe((value: Schema) => { return value })"
|
||||
style: primary
|
||||
start: 28
|
||||
end: 76
|
||||
const view = <Widget value={schema.pipe(value => value)} />:
|
||||
labels:
|
||||
- source: schema.pipe(value => value)
|
||||
style: primary
|
||||
start: 28
|
||||
end: 55
|
||||
const view = <Widget value={schema.pipe(value => { return value })} />:
|
||||
labels:
|
||||
- source: schema.pipe(value => { return value })
|
||||
style: primary
|
||||
start: 28
|
||||
end: 66
|
||||
@@ -0,0 +1,18 @@
|
||||
id: no-identity-pipe
|
||||
valid:
|
||||
- schema
|
||||
- schema.pipe(transform)
|
||||
- schema.pipe((value) => transform(value))
|
||||
- schema.pipe((value) => other)
|
||||
- schema.pipe((value) => { log(value); return value })
|
||||
- schema.pipe((value = fallback) => value)
|
||||
- schema.pipe(({ value }) => value)
|
||||
- schema.pipe((value) => value, transform)
|
||||
- other.call((value) => value)
|
||||
invalid:
|
||||
- schema.pipe((value) => value)
|
||||
- schema.pipe(value => value)
|
||||
- "schema.pipe((value: Schema) => value)"
|
||||
- schema.pipe((value) => { return value })
|
||||
- schema.pipe(value => { return value })
|
||||
- "schema.pipe((value: Schema) => { return value })"
|
||||
@@ -0,0 +1,17 @@
|
||||
id: no-identity-pipe-tsx
|
||||
valid:
|
||||
- const view = <Widget value={schema} />
|
||||
- const view = <Widget value={schema.pipe(transform)} />
|
||||
- const view = <Widget value={schema.pipe((value) => transform(value))} />
|
||||
- const view = <Widget value={schema.pipe((value) => other)} />
|
||||
- const view = <Widget value={schema.pipe((value) => { log(value); return value })} />
|
||||
- const view = <Widget value={schema.pipe((value = fallback) => value)} />
|
||||
- const view = <Widget value={schema.pipe(({ value }) => value)} />
|
||||
- const view = <Widget value={schema.pipe((value) => value, transform)} />
|
||||
invalid:
|
||||
- const view = <Widget value={schema.pipe((value) => value)} />
|
||||
- const view = <Widget value={schema.pipe(value => value)} />
|
||||
- "const view = <Widget value={schema.pipe((value: Schema) => value)} />"
|
||||
- const view = <Widget value={schema.pipe((value) => { return value })} />
|
||||
- const view = <Widget value={schema.pipe(value => { return value })} />
|
||||
- "const view = <Widget value={schema.pipe((value: Schema) => { return value })} />"
|
||||
@@ -0,0 +1,12 @@
|
||||
id: no-identity-pipe-tsx
|
||||
language: Tsx
|
||||
message: Remove identity callbacks from pipe calls.
|
||||
severity: error
|
||||
rule:
|
||||
any:
|
||||
- pattern: $RECEIVER.pipe(($VALUE) => $VALUE)
|
||||
- pattern: $RECEIVER.pipe($VALUE => $VALUE)
|
||||
- pattern: "$RECEIVER.pipe(($VALUE: $TYPE) => $VALUE)"
|
||||
- pattern: $RECEIVER.pipe(($VALUE) => { return $VALUE })
|
||||
- pattern: $RECEIVER.pipe($VALUE => { return $VALUE })
|
||||
- pattern: "$RECEIVER.pipe(($VALUE: $TYPE) => { return $VALUE })"
|
||||
@@ -0,0 +1,12 @@
|
||||
id: no-identity-pipe
|
||||
language: TypeScript
|
||||
message: Remove identity callbacks from pipe calls.
|
||||
severity: error
|
||||
rule:
|
||||
any:
|
||||
- pattern: $RECEIVER.pipe(($VALUE) => $VALUE)
|
||||
- pattern: $RECEIVER.pipe($VALUE => $VALUE)
|
||||
- pattern: "$RECEIVER.pipe(($VALUE: $TYPE) => $VALUE)"
|
||||
- pattern: $RECEIVER.pipe(($VALUE) => { return $VALUE })
|
||||
- pattern: $RECEIVER.pipe($VALUE => { return $VALUE })
|
||||
- pattern: "$RECEIVER.pipe(($VALUE: $TYPE) => { return $VALUE })"
|
||||
Reference in New Issue
Block a user