ESLINT

作者: saronic | 来源:发表于2017-12-27 15:56 被阅读23次

    Install

    npm install -g eslint

    check the version

    eslint --version

    use in CLI

    eslint example.js

    configuration

    可以全局配置,对整个系统起作用。也可以每个项目配置,在当前项目根目录设置 .eslintrc,只作用于当前项目。我倾向于每个项目单独配置,因为不同项目可能使用不同的 style。

    具体过程

    官网配置doc
    在当前 project 根目录新建 .eslintrc

    touch .eslintrc

    写入如下内容:

    {
        "env": {
            "es6": true,
            "browser": true,
            "node": true
        },
        "extends": "eslint:recommended",
        "rules": {
            "no-console": "warn"
        }
    }
    

    相关文章

      网友评论

          本文标题:ESLINT

          本文链接:https://www.haomeiwen.com/subject/vteugxtx.html