chore: effect pattern lint infrastructure (#35210)
This commit is contained in:
parent
1b88ff8d53
commit
1401901529
70 changed files with 524 additions and 234 deletions
22
script/ast-grep/rules/no-drizzle-column-name.yml
Normal file
22
script/ast-grep/rules/no-drizzle-column-name.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
id: no-drizzle-column-name
|
||||
language: TypeScript
|
||||
message: Use snake_case object keys instead of explicit drizzle column names.
|
||||
severity: error
|
||||
files:
|
||||
- packages/core/src/**/sql.ts
|
||||
- packages/core/src/**/*.sql.ts
|
||||
rule:
|
||||
any:
|
||||
- pattern: text($NAME)
|
||||
- pattern: text($NAME, $$$ARGS)
|
||||
- pattern: integer($NAME)
|
||||
- pattern: integer($NAME, $$$ARGS)
|
||||
- pattern: blob($NAME)
|
||||
- pattern: blob($NAME, $$$ARGS)
|
||||
- pattern: real($NAME)
|
||||
- pattern: real($NAME, $$$ARGS)
|
||||
- pattern: numeric($NAME)
|
||||
- pattern: numeric($NAME, $$$ARGS)
|
||||
constraints:
|
||||
NAME:
|
||||
kind: string
|
||||
22
script/ast-grep/rules/no-effect-die-string.yml
Normal file
22
script/ast-grep/rules/no-effect-die-string.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
id: no-effect-die-string
|
||||
language: TypeScript
|
||||
message: die with `new Error(...)`.
|
||||
severity: error
|
||||
rule:
|
||||
any:
|
||||
- all:
|
||||
- pattern: Effect.die($MESSAGE)
|
||||
- has:
|
||||
field: arguments
|
||||
all:
|
||||
- kind: arguments
|
||||
- has:
|
||||
kind: string
|
||||
- all:
|
||||
- pattern: Effect.die($MESSAGE)
|
||||
- has:
|
||||
field: arguments
|
||||
all:
|
||||
- kind: arguments
|
||||
- has:
|
||||
kind: template_string
|
||||
14
script/ast-grep/rules/no-import-alias.yml
Normal file
14
script/ast-grep/rules/no-import-alias.yml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
id: no-import-alias
|
||||
language: TypeScript
|
||||
message: Do not alias value imports. For type name collisions, alias inside a dedicated `import type` statement.
|
||||
severity: error
|
||||
rule:
|
||||
all:
|
||||
- kind: import_specifier
|
||||
- has:
|
||||
field: alias
|
||||
kind: identifier
|
||||
- not:
|
||||
inside:
|
||||
pattern: import type { $$$SPECS } from "$MOD"
|
||||
stopBy: end
|
||||
6
script/ast-grep/rules/no-json-parse-cast.yml
Normal file
6
script/ast-grep/rules/no-json-parse-cast.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
id: no-json-parse-cast
|
||||
language: TypeScript
|
||||
message: Prefer Effect Schema JSON decoding over JSON.parse casts.
|
||||
severity: error
|
||||
rule:
|
||||
pattern: JSON.parse($INPUT) as $TYPE
|
||||
11
script/ast-grep/rules/no-nested-effect-service-yield.yml
Normal file
11
script/ast-grep/rules/no-nested-effect-service-yield.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
id: no-nested-effect-service-yield
|
||||
language: TypeScript
|
||||
message: Bind Effect services before calling methods instead of nesting service yields.
|
||||
severity: error
|
||||
rule:
|
||||
any:
|
||||
- pattern: (yield* $SERVICE).$METHOD($$$ARGS)
|
||||
- pattern: (yield* $SERVICE).$PROPERTY.$METHOD($$$ARGS)
|
||||
constraints:
|
||||
SERVICE:
|
||||
regex: \.Service$
|
||||
10
script/ast-grep/rules/no-star-import.yml
Normal file
10
script/ast-grep/rules/no-star-import.yml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
id: no-star-import
|
||||
language: TypeScript
|
||||
message: Do not use star imports.
|
||||
severity: error
|
||||
rule:
|
||||
all:
|
||||
- kind: namespace_import
|
||||
- inside:
|
||||
kind: import_statement
|
||||
stopBy: end
|
||||
Loading…
Add table
Add a link
Reference in a new issue