Skip to main content

Install and configure

The plugin targets ESLint flat config (ESLint v9+). All rules require type information, so you must also configure @typescript-eslint.

Install

npm install --save-dev @antithrow/eslint-plugin typescript-eslint

Minimal flat config

// eslint.config.ts
import tseslint from "typescript-eslint";
import antithrow from "@antithrow/eslint-plugin";

export default tseslint.config(
...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
antithrow.configs.recommended,
);

antithrow.configs.recommended enables all three rules at the defaults:

RuleSeverity
@antithrow/no-throwing-callwarn
@antithrow/no-unsafe-unwrapwarn
@antithrow/no-unused-resulterror

Tuning individual rules

{
rules: {
"@antithrow/no-throwing-call": "error",
"@antithrow/no-unsafe-unwrap": "error",
},
}

See also