24 lines · 564 B · JavaScript
RawDownload
import { isIdentifier } from "../utils.js"; const message =  "Do not throw raw Error objects in Effect code. Return Effect.fail with a tagged error or assert directly in tests."; const isNewError = (node) => node?.type === "NewExpression" && isIdentifier(node.callee, "Error"); export default {  meta: {    type: "problem",    docs: {      description: message,    },  },  create(context) {    return {      ThrowStatement(node) {        if (isNewError(node.argument)) {          context.report({ node, message });        }      },    };  },};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t