I can not delete warnings from ESLint

2

I'm learning react-native, I've never had a lot of experience with JavaScript, I've installed the ESLint extension, and I'm trying to follow the script for the best syntax.

But there are two warnings that I could not remove and I can not understand why.

The first whenever I put a alert() without importing the content

[eslint] 'alert' is not defined. (no-undef)
function alert(message?: any): void

The second does not require

<Image source={require('./imgs/logo.png')} />

Also regardless of content

[eslint] Unexpected require(). (global-require)
function require(name: string): any

The app works okay even with these warnings but I'd like to understand them

    
asked by anonymous 25.08.2017 / 19:34

1 answer

3

In Eslint you have a configuration file, so you can tell the environments in which you work to have some global variables such as alert and require ( * ) .

So, in the configuration file .eslintrc.js put what you need:

env: {
    browser: true,
    commonjs: true,
    es6: true,
    node: true
},

* - see documentation here

    
25.08.2017 / 19:45