Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint: Require statement not part of import statement.(@typescript-eslint/no-var-requires)

I'm trying to add a background image from react native BackgroundImage which needs to add source as source={require('*--iamge path --*')}

but my eslint throw Require statement not part of import statement. error. i have tried to import image in different ways for example:

 - const image = '--image path--'  - import image = require('--image path--')  - <BackgroundImage source={require('--image path--')}> 
like image 255
Nipun Ravisara Avatar asked Dec 11 '19 02:12

Nipun Ravisara


1 Answers

you can disable this check in eslintrc.js file

module.exports = {   ...   rules: {     ...     '@typescript-eslint/no-var-requires': 0,   } } 
like image 122
Tuan Luong Avatar answered Sep 19 '22 07:09

Tuan Luong