Coder Social home page Coder Social logo

Comments (3)

lcxfs1991 avatar lcxfs1991 commented on May 10, 2024

有一定道理,与其空catch块,不如暴露出来

from eslint-config-alloy.

xcatliu avatar xcatliu commented on May 10, 2024

同意,如果必须为空 catch,则需要加上注释说明原因

from eslint-config-alloy.

xcatliu avatar xcatliu commented on May 10, 2024

试了下,把 allowEmptyCatch: true 去掉后,eslint 仍然允许 empty catch,故允许空 catch 是其默认行为,看了下 airbnb 也是允许空 catch 的。

设为 false 之后,在我们代码中运行了一下,发现空 catch 这种用法还是很常见的,并不是极少数。并且合理的——有的代码希望即使报错也不影响后续运行。

新人将错误掩盖是价值观问题,即使这里强制要求不允许空 catch,新人也可以加 /* eslint no-empty:0 */ 覆盖 eslint 配置。

故这里不做更改。

from eslint-config-alloy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.