Skip to content

Latest commit

 

History

History
65 lines (53 loc) · 1.55 KB

crypto-random-uuid-in-effect.md

File metadata and controls

65 lines (53 loc) · 1.55 KB

cryptoRandomUUIDInEffect

Warns when using crypto.randomUUID() inside Effect generators instead of SecureRandom from effect/crypto

Property Value
Category Effect-native
Default severity off
Fixable No
Effect versions v4
Diagnostic codes TS377079
Language Service name cryptoRandomUUIDInEffect
Oxlint name effecttsgo/crypto-random-uuid-in-effect

Preview

import { Effect } from "effect"

export const preview = Effect.gen(function*() {
  return crypto.randomUUID()
/**
         ^^^^^^^^^^^^^^^^^^^ effecttsgo(crypto-random-uuid-in-effect): This Effect code uses `crypto.randomUUID()`, prefer `SecureRandom` from `effect/crypto` instead.
*/
})

Language Service Configuration

See the Language Service setup guide for installation instructions.

{
  "$schema": "./node_modules/@effect/tsgo/schema.json",
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnosticSeverity": {
          "cryptoRandomUUIDInEffect": "warning"
        }
      }
    ]
  }
}

Oxlint Configuration

See the Oxlint setup guide for installation and patching instructions.

{
  "$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
  "options": {
    "typeAware": true
  },
  "plugins": ["effecttsgo"],
  "rules": {
    "effecttsgo/crypto-random-uuid-in-effect": "warn"
  }
}