Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 642 Bytes

File metadata and controls

55 lines (42 loc) · 642 Bytes

@blitz/catch-error-name

Enforce a specific name in catch clauses

Examples of incorrect code:

try {
  doSomething();
} catch (err) {
  // handle error
}
try {
  doSomething();
} catch (e) {
  // handle error
}

Examples of correct code:

try {
  doSomething();
} catch (error) {
  // handle error
}

Options

type Options = [
  {
    name: string;
    ignore: string[];
  }
];

const defaultOptions: Options = {
  name: 'error',
  ignore: [],
};

name

This option defines the name that is allowed in catch clauses.

ignore

This option defines multiple names that get ignored.