ESLint Setup for React Native Code Checking

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
ESLint Setup for React Native Code Checking
Simple
~1 business day
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Setting Up ESLint for React Native Code

In React Native projects, TypeScript alone doesn't guarantee absence of runtime issues. any spreads throughout the codebase, useEffect with empty dependency array causes bugs with stale closures, components directly mutate parent state via ref. ESLint with the right set of plugins catches these problems statically, before running on device.

Configuration

// eslint.config.mjs (Flat Config, ESLint 9+)
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import reactPlugin from 'eslint-plugin-react';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import reactNativePlugin from 'eslint-plugin-react-native';

export default [
  js.configs.recommended,
  {
    files: ['**/*.{ts,tsx}'],
    languageOptions: {
      parser: typescriptParser,
      parserOptions: {
        project: './tsconfig.json',
        ecmaFeatures: { jsx: true },
      },
    },
    plugins: {
      '@typescript-eslint': typescript,
      react: reactPlugin,
      'react-hooks': reactHooksPlugin,
      'react-native': reactNativePlugin,
    },
    rules: {
      ...typescript.configs['recommended-type-checked'].rules,
      '@typescript-eslint/no-explicit-any': 'error',
      '@typescript-eslint/no-floating-promises': 'error',
      '@typescript-eslint/await-thenable': 'error',
      'react-hooks/rules-of-hooks': 'error',
      'react-hooks/exhaustive-deps': 'warn',
      'react-native/no-unused-styles': 'error',
      'react-native/no-inline-styles': 'warn',
      'react-native/no-color-literals': 'warn',
    },
  },
];

recommended-type-checked requires project: './tsconfig.json' — analysis with type awareness. Slower, but catches what recommended misses: @typescript-eslint/no-floating-promises finds await without try/catch on async functions.

Key Plugins for React Native

  • eslint-plugin-react-hooks — mandatory. exhaustive-deps rule catches 90% of useEffect bugs
  • eslint-plugin-react-nativeno-unused-styles finds StyleSheet.create styles that aren't used anywhere (common leak in large components)
  • @typescript-eslint with type-checking — catches any, floating promises, unsafe assignments

Prettier + ESLint

npm install --save-dev prettier eslint-config-prettier

eslint-config-prettier disables ESLint rules that conflict with Prettier. In eslint.config.mjs add prettierConfig last — it overrides formatting rules.

.prettierrc:

{
  "semi": true,
  "trailingComma": "all",
  "singleQuote": true,
  "printWidth": 100,
  "bracketSpacing": true
}

CI Integration

- name: Lint
  run: npx eslint . --ext .ts,.tsx --max-warnings 0

- name: Format check
  run: npx prettier --check "src/**/*.{ts,tsx}"

--max-warnings 0 — zero warnings allowed. Without this flag ESLint exits with code 0 even with warnings.

Pre-commit via lint-staged

// package.json
{
  "lint-staged": {
    "*.{ts,tsx}": [
      "eslint --fix --max-warnings 0",
      "prettier --write"
    ]
  }
}
npx husky add .husky/pre-commit "npx lint-staged"

Timeline: 1 day. Cost is calculated individually.