eslint-plugin-no-empty-blocks

An extended version of the `no-empty` rule that adds an option to allow empty catch blocks.

MIT 2 个版本
安装
npm install eslint-plugin-no-empty-blocks
yarn add eslint-plugin-no-empty-blocks
pnpm add eslint-plugin-no-empty-blocks
bun add eslint-plugin-no-empty-blocks
README

eslint-plugin-no-empty-blocks

An ESLint rule for eliminating empty block statements. It is an extended version of the no-empty rule that allows empty catch blocks.

Why Use It

ESLint has the built-in no-empty rule that is aimed at eliminating empty block statements. It throws a warning at empty catch blocks such as this one:

try {
  doSomething();
} catch(e) {}

But this technique can be useful for ignoring errors, and this plugin provides an option to allow it.

Usage

Add no-empty-blocks to the plugins section of your .eslintrc:

{
  "plugins": [
    "no-empty-blocks"
  ]
}

Turn off the no-empty rule:

{
  "rules": {
    "no-empty": 0
  }
}
版本列表
0.0.2 2015-06-07
0.0.1 2015-06-07