美文网首页
【随笔】ESLint常用设置总结

【随笔】ESLint常用设置总结

作者: 赵思温 | 来源:发表于2017-07-06 10:33 被阅读0次

    文件: .eslintrc.json

    内容:

    {

    "env": {
      "browser": true,
      "es6": true,
      "node": true
    },
    "parserOptions": {
      "sourceType": "module"
    },
    "rules": {

    "no-cond-assign": [2, "always"], //if, while等条件中不允许使用“=”
    "no-constant-condition": 2,
    "no-debugger": 2, // 程序中不能出现debugger
    "no-dupe-args": 2, // 函数的参数名称不能重复
    "no-dupe-keys": 2, // 对象的属性名称不能重复
    "no-duplicate-case": 2, // switch的case不能重复
    "no-func-assign": 2,
    "no-obj-calls": 2,
    "no-regex-spaces": 2,
    "no-sparse-arrays": 2,
    "no-unexpected-multiline": 2,
    "no-unreachable": 2,
    "use-isnan": 2,
    "valid-typeof": 2,
    "eqeqeq": [2, "always"],
    "no-caller": 2,
    "no-eval": 2,
    "no-redeclare": 2,
    "no-undef": 2,
    "no-unused-vars": 1,
    "no-use-before-define": 2,
    "comma-dangle": [1, "never"],
    "no-const-assign": 2,
    "no-dupe-class-members": 2

    }

    }

    Preferences->Package Settings->SublimeLinter->Settings - User
    {
    "user": {
    "debug": true, # 开启 debug 选项
    "delay": 0.25,
    "error_color": "D02000",
    "gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
    "gutter_theme_excludes": [],
    "lint_mode": "background",
    "linters": {
    "eslint": {
    "@disable": false,
    "args": [],
    "excludes": []
    },
    "jshint": {
    "@disable": false,
    "args": [],
    "excludes": []
    },
    "php": {
    "@disable": false,
    "args": [],
    "excludes": []
    }
    },
    "mark_style": "outline",
    "no_column_highlights_line": false,
    "passive_warnings": false,
    "paths": {
    "linux": [],
    "osx": [
    "/Users/wang/.nvm/versions/node/v5.0.0/bin" # 设置 node 路径
    ],
    "windows": []
    },
    "python_paths": {
    "linux": [],
    "osx": [],
    "windows": []
    },
    "rc_search_limit": 3,
    "shell_timeout": 10,
    "show_errors_on_save": false,
    "show_marks_in_minimap": true,
    "syntax_map": {
    "html (django)": "html",
    "html (rails)": "html",
    "html 5": "html",
    "javascript (babel)": "javascript",
    "magicpython": "python",
    "php": "html",
    "python django": "python",
    "pythonimproved": "python"
    },
    "warning_color": "DDB700",
    "wrap_find": true
    }
    }

    相关文章

      网友评论

          本文标题:【随笔】ESLint常用设置总结

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