eslint-plugin-nozbe

A collection of helpful ESLint rules we created while building Nozbe app.

Installation

yarn add --dev @nozbe/eslint-plugin-nozbe

In your .eslintrc.{js,yml,json}, add plugin:

  plugins: [
    '@nozbe/nozbe',
  ],

Then add rules you want to include

JSX no &&

  rules: [
    '@nozbe/nozbe/no-jsx-andand': 'error',
  ]

This raises an error for && used in JSX expressions, like so:

<>
  {shouldShowFoo && <Foo />}
</>

Expressions like this behave differently on React and React Native: instead of not displaying, it can evaluate to 0, NaN, or cause a crash in some cases..

This auto-fixes to:

<>
  {shouldShowFoo ? <Foo /> : null}
</>

GitHub

View Github