React Native's ESLint


What is React Native's ESLint?

ESLint in React Native ESLint is an open-source project created by Nicholas C. Zakas in June 2013. Its goal is to provide a pluggable linting utility for JavaScript, and Javascript usually has thousands of libraries in question. A quick search for ESLint in React Native will show something like eslintpluginreactnative.

What is ESLint used for?

ESLint is a static code analysis tool for identifying problematic patterns in JavaScript code. Nicholas C. Zakas created it in 2013. ESLint rules are configurable, and custom rules can be defined and loaded.

How to configure ESLint in React Native?

  • Install ESLint globally $ npm install eslint --global
  • Install Locally $ npm install --save-dev eslint
  • Configure ESLint $ eslint –init
  • Add react-native to the plugins section
  • Configure ESLint to support JSX
  • Whitelist all browser-like globals by adding react-native/react-native to the config

At this point, this is a working ESLint configuration; if you run $eslintMyAwesomFile.js, the linter should run. To fix it, install babel-eslint $ npm install bale-eslint—save-dev add babel-eslint to the parser section of the config file and plugin: react/recommended to extends.