【问题标题】:eslint cannot resolve $ReadOnlyArrayeslint 无法解析 $ReadOnlyArray
【发布时间】:2018-07-09 01:33:21
【问题描述】:

当我尝试使用 $ReadOnlyArray 时,eslint 显示错误“$ReadOnlyArray is not defined (no-undef)”。我可能有错误的配置,但我不知道从哪里开始。

这里有一些环境信息:

  • 反应原生:0.51.0
  • 流量:0.57
  • eslint:4.9.0,
  • eslint-plugin-flow: 6.23.0

【问题讨论】:

    标签: react-native eslint flowtype


    【解决方案1】:

    您需要按如下方式安装 Flow 类型的 linting 规则:

    npm install eslint-plugin-flowtype --save-dev
    

    您的 .eslintrc 文件应如下所示:

    {
        "parser": "babel-eslint",
        "env": {
        },
        "plugins": [            
            "flowtype"        
        ],
        "extends": [
            "eslint:recommended",
            "plugin:flowtype/recommended"
        ],
        "rules": {            
        }
    }
    

    【讨论】:

    • 感谢您的帮助 ;)
    猜你喜欢
    • 2022-06-23
    • 2022-11-11
    • 2021-12-27
    • 2018-03-17
    • 2021-11-10
    • 2023-01-24
    • 2021-03-04
    • 2022-12-19
    • 2017-12-05
    相关资源
    最近更新 更多