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

后端 未结 2 1461
生来不讨喜
生来不讨喜 2021-02-19 05:46

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

<
相关标签:
2条回答
  • 2021-02-19 05:53

    It's also possible to disable it for individual files, instead of globally disabling it for the whole project.

    Add at the top of the file:

    /* eslint @typescript-eslint/no-var-requires: "off" */
    
    0 讨论(0)
  • 2021-02-19 06:09

    you can disable this check in eslintrc.js file

    module.exports = {
      ...
      rules: {
        ...
        '@typescript-eslint/no-var-requires': 0,
      }
    }
    
    0 讨论(0)
提交回复
热议问题