zoukankan      html  css  js  c++  java
  • 使用airbnb的eslint

    1. 全局安装eslint

    npm install -g eslint 
    npm install -g eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y babel-eslint
    

    2.在项目目录下新建.eslintrc文件

    添加内容

    {
      "extends": "airbnb",
      "parser": "babel-eslint",
      "env": {
        "browser": true,
        "node": true,
        "mocha": true
      },
      "globals": {
        "Babel": true,
        "React": true
      },
      "plugins": [
        "react"
      ],
      "rules": {
        "global-require": "off",
        "import/no-unresolved": "off",
        "no-underscore-dangle": "off",
        "no-new-func": "off",
        "no-param-reassign": "off",
        "react/prefer-stateless-function": "off",
        "react/no-multi-comp": "off",
        "react/jsx-no-bind": "off",
        "react/jsx-indent": "off",
        "react/jsx-first-prop-new-line": "off",
        "react/jsx-filename-extension": "off",
        "no-restricted-syntax": "off"
      }
    }
    

    3. 编辑器配置linter

    vscode

    F1->install Extensions,选择 ESLint 即可

    sublime text3

    install pacakge,选择 SublimeLinter
    install pacakge,选择 SublimeLinter-contrib-eslint
    SublimeLinter: Enable Linter

  • 相关阅读:
    《css世界》学习摘要
    微信小程序知识点积累
    事件冒泡 事件委派
    遍历后台返回数据
    初识open stack
    keystone初识
    KVM详解
    openstack详解
    NoSQL之Redis集群理论
    gfs分布式文件系统
  • 原文地址:https://www.cnblogs.com/samwu/p/5772778.html
Copyright © 2011-2022 走看看