zoukankan      html  css  js  c++  java
  • eslint-config-standard引入项目的问题

    项目eslint使用eslint-config-standard标准,

    在执行npm run lint后发现只要有import或者export这类关键词的js文件都会报以下三个错

    1:1  error  Definition for rule 'no-async-promise-executor' was not found      no-async-promise-executor
      1:1  error  Definition for rule 'no-misleading-character-class' was not found  no-misleading-character-class
      1:1  error  Definition for rule 'no-useless-catch' was not found               no-useless-catch

    而这三个规则是检验promise的,显然这里是误报。

    找了很久的解决方案

    最后查看该npm包的更新日志发现  https://standardjs.com/changelog.html

    在13.0版本开始默认增加了这三个规则,但估计是跟某些其他包配合的时候产生了bug,导致误报

    解决方法:

    方案一:

    将eslint-config-standard的npm版本降至12以下

    cnpm i eslint-config-standard@10.2.1 --save-dev

    方案二:

    在eslintrc.js的rules里添加off

        'no-async-promise-executor' : 'off',
        'no-misleading-character-class' : 'off',
        'no-useless-catch' : 'off'
  • 相关阅读:
    自己开发网站全文检索系统
    中国摇滚二十年(经典100首歌曲)
    有一首歌
    Snoopy.class.php使用手册
    wp-Syntax 插件使用方法
    rabbitmq使用
    小程序相关功能的实现
    知识链接
    celery使用
    阿里云服务器部署项目注意事项
  • 原文地址:https://www.cnblogs.com/lw5116/p/12222091.html
Copyright © 2011-2022 走看看