0.3.1 • Published 12 months ago

eslint-plugin-handle-errors v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

ESLint Plugin Handle Errors

npm

ESLint rules for handling errors.

Installation

npm

npm install -D eslint-plugin-handle-errors

Yarn

yarn add -D eslint-plugin-handle-errors

pnpm

pnpm add -D eslint-plugin-handle-errors

Usage

Flat config (eslint.config.js)

import eslint from '@eslint/js';
import handleErrors from 'eslint-plugin-handle-errors';

export default [
    eslint.configs.recommended, // optional
    handleErrors.configs.recommended,
];

Legacy config (.eslintrc)

{
    "extends": ["plugin:handle-errors/legacy-recommended"]
}

Settings

Logger functions

You can customize the logger functions that are used to log errors in your project.

import eslint from '@eslint/js';
import handleErrors from 'eslint-plugin-handle-errors';

export default [
    {
        settings: {
            handleErrors: {
                loggerFunctions: ['Sentry.captureException', 'reportError'],
            },
        },
    },
    eslint.configs.recommended,
    handleErrors.configs.recommended,
];

Rules

āœ… Set in the recommended configuration\ šŸ”§ Automatically fixable by the --fix CLI option\ šŸ’” Manually fixable by editor suggestions

RuleDescriptionāœ…šŸ”§šŸ’”
log-error-in-trycatchEnforce error logging in Try-Catch blocksāœ…
log-error-in-promisesEnforces error logging in Promise.catch handlersāœ…
0.3.0

12 months ago

0.3.1

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago