30 lines · 843 B · JavaScript
RawDownload
import { getPropertyName, isIdentifier, unwrapExpression } from "../utils.js"; const message =  "Do not use Promise .catch(). Model async failures with Effect.tryPromise and typed Effect error handling. Skill: wrdn-effect-typed-errors."; const isCatchMember = (node) => {  const expression = unwrapExpression(node);  if (isIdentifier(unwrapExpression(expression?.object), "Effect")) return false;  return (    expression?.type === "MemberExpression" && getPropertyName(expression.property) === "catch"  );}; export default {  meta: {    type: "problem",    docs: {      description: "Disallow Promise-style .catch() error handling.",    },  },  create(context) {    return {      CallExpression(node) {        if (isCatchMember(node.callee)) {          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