0.2.1 ā€¢ Published 26 days ago

eslint-plugin-handle-errors v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
26 days 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 handleErrors from 'eslint-plugin-handle-errors';

export default [
    {
        ...handleErrors.configs['flat/recommended'],
        files: ['src/**'],
    },
];

Legacy config (.eslintrc)

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

Settings

Logger functions

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

{
    "settings": {
        "handleErrors": {
            "loggerFunctions": [
                "console.error", 
                "console.warn", 
                "Sentry.captureException", 
                "logError"
            ]
        }
    }
}

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.2.1

26 days ago

0.2.0

26 days ago

0.1.1

27 days ago

0.1.0

27 days ago