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


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

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

  plugins: [

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}


View Github