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
- Yarn
- pnpm
- Bun
npm install --save-dev @antithrow/eslint-plugin typescript-eslint
yarn add --dev @antithrow/eslint-plugin typescript-eslint
pnpm add --save-dev @antithrow/eslint-plugin typescript-eslint
bun add --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:
| Rule | Severity |
|---|---|
@antithrow/no-throwing-call | warn |
@antithrow/no-unsafe-unwrap | warn |
@antithrow/no-unused-result | error |
Tuning individual rules
{
rules: {
"@antithrow/no-throwing-call": "error",
"@antithrow/no-unsafe-unwrap": "error",
},
}
See also
- Reference:
no-throwing-call - Reference:
no-unsafe-unwrap - Reference:
no-unused-result