问题
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--')}>
回答1:
you can disable this check in eslintrc.js
file
module.exports = {
...
rules: {
...
'@typescript-eslint/no-var-requires': 0,
}
}
来源:https://stackoverflow.com/questions/59278151/eslint-require-statement-not-part-of-import-statement-typescript-eslint-no-va