1.0.6 • Published 1 year ago

@arabasta/eslint-plugin-report-caught-error v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@arabasta/eslint-plugin-report-caught-error

NPM Version NPM License

ESLint plugin that enforces caught errors in try/catches to be reported.

Installation

Assuming you already have ESLint installed, run:

# npm
npm install --save-dev @arabasta/eslint-plugin-report-caught-error

# yarn
yarn add --dev @arabasta/eslint-plugin-report-caught-error

# pnpm
pnpm add --save-dev @arabasta/eslint-plugin-report-caught-error

Usage

Flat config (eslint.config.js)

// ...
import reportCaughtError from '@arabasta/eslint-plugin-report-caught-error';

export default [
  // ...
  reportCaughtError.configs.recommended,
];

Legacy config (.eslintrc)

{
  "extends": [
    // ...
    "plugin:@arabasta/report-caught-error/recommended-legacy"
  ]
}

Rules

āœ… Set in the recommended configuration\ šŸ’” Manually fixable by editor suggestions

RuleDescriptionāœ…šŸ’”
report-caught-errorEnforce that caught errors are reportedāœ…šŸ’”

report-caught-error

Options

This rule has a string option. The string should be your report function.

  • console.error (default)

For example, in order to configure your report function to be reportUnknownError, you can use the following configuration:

"@arabasta/report-caught-error/report-caught-error": [<severity>, "reportUnknownError"]

Examples of incorrect code for this rule:

try {
} catch (error) {
  foo();
}

Examples of correct code for this rule:

try {
} catch (error) {
  console.error(error);
  foo();
}

License

MIT

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago